src/Zicht/Bundle/MessagesBundle/Subscriber/FlushCatalogueCacheSubscriber.php
public function onFlush($args)
    {
        if (!$this->isDirty) {
            /** @var $em \Doctrine\ORM\EntityManager */
            $em = $args->getEntityManager();

            /** @var $uow \Doctrine\ORM\UnitOfWork */
            $uow = $em->getUnitOfWork();

            $array = array(
                $uow->getScheduledEntityUpdates(),
                $uow->getScheduledEntityDeletions(),
                $uow->getScheduledEntityInsertions(),
                $uow->getScheduledCollectionUpdates(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionUpdates()
            );

            foreach ($array as $obj) {
                foreach ($obj as $element) {
                    if ($element instanceof Entity\Message
                     || $element instanceof Entity\MessageTranslation
                    ) {
                        $this->isDirty = true;
                        break 2;
                    }
                }
            }
        }

        $this->flushCache();
    }
public function onFlush($args)
    {
        if (!$this->isDirty) {
            /** @var $em \Doctrine\ORM\EntityManager */
            $em = $args->getEntityManager();

            /** @var $uow \Doctrine\ORM\UnitOfWork */
            $uow = $em->getUnitOfWork();

            $array = array(
                $uow->getScheduledEntityUpdates(),
                $uow->getScheduledEntityDeletions(),
                $uow->getScheduledEntityInsertions(),
                $uow->getScheduledCollectionUpdates(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionUpdates()
            );

            foreach ($array as $obj) {
                foreach ($obj as $element) {
                    if ($element instanceof Entity\Message
                     || $element instanceof Entity\MessageTranslation
                    ) {
                        $this->isDirty = true;
                        break 2;
                    }
                }
            }
        }

        $this->flushCache();
    }
public function onFlush ( $ args ) { if ( ! $ this -> isDirty ) { /** @var $em \Doctrine\ORM\EntityManager */ $ em = $ args -> getEntityManager ( ) ; /** @var $uow \Doctrine\ORM\UnitOfWork */ $ uow = $ em -> getUnitOfWork ( ) ; $ array = array ( $ uow -> getScheduledEntityUpdates ( ) , $ uow -> getScheduledEntityDeletions ( ) , $ uow -> getScheduledEntityInsertions ( ) , $ uow -> getScheduledCollectionUpdates ( ) , $ uow -> getScheduledCollectionDeletions ( ) , $ uow -> getScheduledCollectionDeletions ( ) , $ uow -> getScheduledCollectionUpdates ( ) ) ; foreach ( $ array as $ obj ) { foreach ( $ obj as $ element ) { if ( $ element instanceof Entity \ Message || $ element instanceof Entity \ MessageTranslation ) { $ this -> isDirty = true ; break 2 ; } } } } $ this -> flushCache ( ) ; }
Listens to the flush event and checks if any of the configured entities was inserted, updated or deleted.
If so, invokes the helper to

@param mixed $args
@return void
Listens to the flush event and checks if any of the configured entities was inserted updated or deleted . If so invokes the helper to