Skip to content

Commit

Permalink
It makes no sense to access properties through methods, as we need to…
Browse files Browse the repository at this point in the history
… work with the raw values.
  • Loading branch information
rjkip committed Jun 26, 2013
1 parent 0f8bb7d commit efc29b5
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions Subscribers/DoctrineEncryptSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,10 @@ private function processFields($entity, $isEncryptOperation = true)
if ($this->annReader->getPropertyAnnotation($refProperty, self::ENCRYPTED_ANN_NAME)) {
$withAnnotation = true;
// we have annotation and if it decrypt operation, we must avoid duble decryption
$propName = $refProperty->getName();
if ($refProperty->isPublic()) {
$entity->$propName = $this->encryptor->$encryptorMethod($refProperty->getValue());
} else {
$methodName = self::capitalize($propName);
if ($reflectionClass->hasMethod($getter = 'get' . $methodName) && $reflectionClass->hasMethod($setter = 'set' . $methodName)) {
$currentPropValue = $this->encryptor->$encryptorMethod($entity->$getter());
$entity->$setter($currentPropValue);
} else {
$refProperty->setAccessible(true);
$value = $refProperty->getValue($entity);
$value = $this->encryptor->$encryptorMethod($value);
$refProperty->setValue($entity, $value);
}
}
$refProperty->setAccessible(true);
$value = $refProperty->getValue($entity);
$value = $this->encryptor->$encryptorMethod($value);
$refProperty->setValue($entity, $value);
}
}

Expand Down

0 comments on commit efc29b5

Please sign in to comment.