public function onFlush(OnFlushEventArgs $eventArgs)
    {
        $this->entityManager = $eventArgs->getEntityManager();
        $validatedInstancesContainer = new \SplObjectStorage();

        $this->deduplicateValueObjectInsertions();

        $unitOfWork = $this->entityManager->getUnitOfWork();
        foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) {
            $this->validateObject($entity, $validatedInstancesContainer);
        }

        foreach ($unitOfWork->getScheduledEntityUpdates() as $entity) {
            $this->validateObject($entity, $validatedInstancesContainer);
        }
    }
public function onFlush(OnFlushEventArgs $eventArgs)
    {
        $this->entityManager = $eventArgs->getEntityManager();
        $validatedInstancesContainer = new \SplObjectStorage();

        $this->deduplicateValueObjectInsertions();

        $unitOfWork = $this->entityManager->getUnitOfWork();
        foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) {
            $this->validateObject($entity, $validatedInstancesContainer);
        }

        foreach ($unitOfWork->getScheduledEntityUpdates() as $entity) {
            $this->validateObject($entity, $validatedInstancesContainer);
        }
    }
public function onFlush ( OnFlushEventArgs $ eventArgs ) { $ this -> entityManager = $ eventArgs -> getEntityManager ( ) ; $ validatedInstancesContainer = new \ SplObjectStorage ( ) ; $ this -> deduplicateValueObjectInsertions ( ) ; $ unitOfWork = $ this -> entityManager -> getUnitOfWork ( ) ; foreach ( $ unitOfWork -> getScheduledEntityInsertions ( ) as $ entity ) { $ this -> validateObject ( $ entity , $ validatedInstancesContainer ) ; } foreach ( $ unitOfWork -> getScheduledEntityUpdates ( ) as $ entity ) { $ this -> validateObject ( $ entity , $ validatedInstancesContainer ) ; } }
An onFlush event listener used to act upon persistence.

@param OnFlushEventArgs $eventArgs
@return void
@throws ObjectValidationFailedException
An onFlush event listener used to act upon persistence .