Exemplo n.º 1
0
 /**
  * @param LifecycleEventArgs $args
  */
 private function encrypt(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;
         }
         $originalValue = $entity->{$getter}();
         if ($originalValue !== null) {
             $entity->{$setter}($this->encryptor->encrypt($originalValue));
         }
     }
 }
Exemplo n.º 2
0
 /**
  * @group unit
  */
 public function testEncrypt()
 {
     $this->assertEquals('+P24cXIcklfKOHOuFRkIE3WprB6W11NRZnzg8SJRGoM=', $this->encryption->encrypt('alpha'));
 }