Subscribers/DoctrineEncryptSubscriber.php
public function preUpdate(PreUpdateEventArgs $args) {
        $reflectionClass = new ReflectionClass($args->getEntity());
        $properties = $reflectionClass->getProperties();
        foreach ($properties as $refProperty) {
            if ($this->annReader->getPropertyAnnotation($refProperty, self::ENCRYPTED_ANN_NAME)) {
                $propName = $refProperty->getName();
                $args->setNewValue($propName, $this->encryptor->encrypt($args->getNewValue($propName)));
            }
        }
    }
public function preUpdate(PreUpdateEventArgs $args) {
        $reflectionClass = new ReflectionClass($args->getEntity());
        $properties = $reflectionClass->getProperties();
        foreach ($properties as $refProperty) {
            if ($this->annReader->getPropertyAnnotation($refProperty, self::ENCRYPTED_ANN_NAME)) {
                $propName = $refProperty->getName();
                $args->setNewValue($propName, $this->encryptor->encrypt($args->getNewValue($propName)));
            }
        }
    }
public function preUpdate ( PreUpdateEventArgs $ args ) { $ reflectionClass = new ReflectionClass ( $ args -> getEntity ( ) ) ; $ properties = $ reflectionClass -> getProperties ( ) ; foreach ( $ properties as $ refProperty ) { if ( $ this -> annReader -> getPropertyAnnotation ( $ refProperty , self :: ENCRYPTED_ANN_NAME ) ) { $ propName = $ refProperty -> getName ( ) ; $ args -> setNewValue ( $ propName , $ this -> encryptor -> encrypt ( $ args -> getNewValue ( $ propName ) ) ) ; } } }
Listen a preUpdate lifecycle event. Checking and encrypt entities fields
which have @Encrypted annotation. Using changesets to avoid preUpdate event
restrictions
@param PreUpdateEventArgs $args
Listen a preUpdate lifecycle event . Checking and encrypt entities fields which have