/** * @param LifecycleEventArgs $args */ public function postLoad(LifecycleEventArgs $args) { $entity = $args->getEntity(); $properties = $this->getAnnotatedProperties($entity); if (empty($properties)) { return; } foreach ($properties as $property) { $getter = $this->getGetter($property, $entity); $setter = $this->getSetter($property, $entity); if (null === $getter || null === $getter) { continue; } $encryptedValue = $entity->{$getter}(); if ($encryptedValue !== null) { $entity->{$setter}($this->encryptor->decrypt($encryptedValue)); } } }
/** * @group unit */ public function testDecrypt() { $this->assertEquals('alpha', $this->encryption->decrypt('+P24cXIcklfKOHOuFRkIE3WprB6W11NRZnzg8SJRGoM=')); }