src/Config/EventListener/Entity/Config/EncryptListener.php
public function preFlush(PreFlushEventArgs $args)
    {
        $entities = $args->getEntityManager()->getUnitOfWork()->getScheduledEntityInsertions();

        foreach ($entities as $entity) {
            if (!$entity instanceof Config) {
                continue;
            }

            $key = $entity->getKey();
            $encrypt = $this->configCollection->get($key)['encrypt'];
            $entity->setEncrypt($encrypt);
        }
    }
public function preFlush(PreFlushEventArgs $args)
    {
        $entities = $args->getEntityManager()->getUnitOfWork()->getScheduledEntityInsertions();

        foreach ($entities as $entity) {
            if (!$entity instanceof Config) {
                continue;
            }

            $key = $entity->getKey();
            $encrypt = $this->configCollection->get($key)['encrypt'];
            $entity->setEncrypt($encrypt);
        }
    }
public function preFlush ( PreFlushEventArgs $ args ) { $ entities = $ args -> getEntityManager ( ) -> getUnitOfWork ( ) -> getScheduledEntityInsertions ( ) ; foreach ( $ entities as $ entity ) { if ( ! $ entity instanceof Config ) { continue ; } $ key = $ entity -> getKey ( ) ; $ encrypt = $ this -> configCollection -> get ( $ key ) [ 'encrypt' ] ; $ entity -> setEncrypt ( $ encrypt ) ; } }
Set config entity encrypt property before saving in storage.

@param \Doctrine\ORM\Event\PreFlushEventArgs $args
Set config entity encrypt property before saving in storage .