public function onFlush(OnFlushEventArgs $eventArgs)
    {
        $this->pages = new ArrayCollection();

        $this->manager = $eventArgs->getEntityManager();
        $uow = $this->manager->getUnitOfWork();

        foreach ($uow->getScheduledEntityUpdates() as $entity) {
            $this->handleEntity($entity);
        }
        /** @var \Doctrine\Common\Collections\ArrayCollection $col */
        foreach ($uow->getScheduledCollectionUpdates() as $col) {
            foreach ($col as $entity) {
                $this->handleEntity($entity);
            }
        }

        if (0 < $this->pages->count()) {
            $this->persister->replaceMany($this->pages->toArray());
        }
    }
public function onFlush(OnFlushEventArgs $eventArgs)
    {
        $this->pages = new ArrayCollection();

        $this->manager = $eventArgs->getEntityManager();
        $uow = $this->manager->getUnitOfWork();

        foreach ($uow->getScheduledEntityUpdates() as $entity) {
            $this->handleEntity($entity);
        }
        /** @var \Doctrine\Common\Collections\ArrayCollection $col */
        foreach ($uow->getScheduledCollectionUpdates() as $col) {
            foreach ($col as $entity) {
                $this->handleEntity($entity);
            }
        }

        if (0 < $this->pages->count()) {
            $this->persister->replaceMany($this->pages->toArray());
        }
    }
public function onFlush ( OnFlushEventArgs $ eventArgs ) { $ this -> pages = new ArrayCollection ( ) ; $ this -> manager = $ eventArgs -> getEntityManager ( ) ; $ uow = $ this -> manager -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityUpdates ( ) as $ entity ) { $ this -> handleEntity ( $ entity ) ; } /** @var \Doctrine\Common\Collections\ArrayCollection $col */ foreach ( $ uow -> getScheduledCollectionUpdates ( ) as $ col ) { foreach ( $ col as $ entity ) { $ this -> handleEntity ( $ entity ) ; } } if ( 0 < $ this -> pages -> count ( ) ) { $ this -> persister -> replaceMany ( $ this -> pages -> toArray ( ) ) ; } }
Flush event handler.

@param OnFlushEventArgs $eventArgs
Flush event handler .