Subscribers/GdprSubscriber.php
/**
     * Update the PersonalData object before we persist it to the database.
     *
     * Notice that we do not recalculate changes otherwise the entity will be written
     * every time (Because it is going to differ from the un-encrypted value)
     *
     * @param OnFlushEventArgs $args
     */
Update the PersonalData object before we persist it to the database.
Notice that we do not recalculate changes otherwise the entity will be written
every time (Because it is going to differ from the un-encrypted value)


Update the PersonalData object before we persist it to the database . Notice that we do not recalculate changes otherwise the entity will be written every time ( Because it is going to differ from the un - encrypted value )
public function onFlush(OnFlushEventArgs $args)
    {
        $em = $args->getEntityManager();
        $unitOfWork = $em->getUnitOfWork();
        $this->postFlushDecryptQueue = array();
        foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) {
            $this->entityOnFlush($entity, $em, true);
            $unitOfWork->recomputeSingleEntityChangeSet($em->getClassMetadata(get_class($entity)), $entity);
        }
        foreach ($unitOfWork->getScheduledEntityUpdates() as $entity) {
            $this->entityOnFlush($entity, $em, false);
            $unitOfWork->recomputeSingleEntityChangeSet($em->getClassMetadata(get_class($entity)), $entity);
        }
    }
public function onFlush ( OnFlushEventArgs $ args ) { $ em = $ args -> getEntityManager ( ) ; $ unitOfWork = $ em -> getUnitOfWork ( ) ; $ this -> postFlushDecryptQueue = array ( ) ; foreach ( $ unitOfWork -> getScheduledEntityInsertions ( ) as $ entity ) { $ this -> entityOnFlush ( $ entity , $ em , true ) ; $ unitOfWork -> recomputeSingleEntityChangeSet ( $ em -> getClassMetadata ( get_class ( $ entity ) ) , $ entity ) ; } foreach ( $ unitOfWork -> getScheduledEntityUpdates ( ) as $ entity ) { $ this -> entityOnFlush ( $ entity , $ em , false ) ; $ unitOfWork -> recomputeSingleEntityChangeSet ( $ em -> getClassMetadata ( get_class ( $ entity ) ) , $ entity ) ; } }
Update the PersonalData object before we persist it to the database.
Update the PersonalData object before we persist it to the database .
// Note that the third parameter is set to true for new entity insertions.