src/EventListener/CollectsEventsFromEntities.php
public function postFlush(PostFlushEventArgs $eventArgs)
    {
        $em = $eventArgs->getEntityManager();
        $uow = $em->getUnitOfWork();
        foreach ($uow->getIdentityMap() as $entities) {
            foreach ($entities as $entity){
                $this->collectEventsFromEntity($entity);
            }
        }
    }
public function postFlush(PostFlushEventArgs $eventArgs)
    {
        $em = $eventArgs->getEntityManager();
        $uow = $em->getUnitOfWork();
        foreach ($uow->getIdentityMap() as $entities) {
            foreach ($entities as $entity){
                $this->collectEventsFromEntity($entity);
            }
        }
    }
public function postFlush ( PostFlushEventArgs $ eventArgs ) { $ em = $ eventArgs -> getEntityManager ( ) ; $ uow = $ em -> getUnitOfWork ( ) ; foreach ( $ uow -> getIdentityMap ( ) as $ entities ) { foreach ( $ entities as $ entity ) { $ this -> collectEventsFromEntity ( $ entity ) ; } } }
We need to listen on postFlush for Lifecycle Events
All Lifecycle callback events are triggered after the onFlush event

@param PostFlushEventArgs $eventArgs
We need to listen on postFlush for Lifecycle Events All Lifecycle callback events are triggered after the onFlush event