Symfony 2 Doctrine event subscribers onFlush/PostFlush don't firing in external bundle
<p>I encounter a problem when I want to execute some code post doctrine Flush with a subscriber. When i'm updating an entity, my <code>on/post flush</code> functions are not executed. </p>

<p>I have no error (or anything else) in symfony logs, nothing in nginx/php logs even if I cause a syntax error in my event. I restarted my php and cleared my cache. </p>

<p>As <a href="http://symfony.com/doc/2.8/doctrine/event_listeners_subscribers.html#creating-the-subscriber-class" rel="nofollow">the symfony doc says for my symfony version (2.8)</a> I made the following : </p>

<p><strong>MyBundle\EventSubscriber\MyEntityUpdatedEventSubscriber</strong></p>

<pre><code>&lt;?php

namespace MyBundle\EventSubscriber;

use Doctrine\ORM\Event\OnFlushEventArgs;
use Doctrine\Common\EventSubscriber;

class MyEntityEventSubscriber implements EventSubscriber
{
    public function __construct(MySuperService $myService)
    {
        $this-&gt;myService = $myService;
    }

    public function getSubscribedEvents()
    {
        return array(
            'onFlush',
            'postFlush',
        );
    }

    public function onFlush(OnFlushEventArgs $args)
    {
        $uow = $args-&gt;getEntityManager()-&gt;getUnitOfWork();

        foreach ($uow-&gt;getScheduledEntityInsertions() as $entity) {
            // bla bla
        }
        //some interesting code
    }

    public function postFlush()
    {
        //Another interesting lines
    }
}
</code></pre>

<p>My service declaration looks like this : </p>

<p><strong>MyBundle/Resources/config/service.yml</strong></p>

<pre><code>services:
    my_bundle.event.myentity_updated:
        class: MyBundle\EventSubscriber\MyEntityUpdatedEventSubscriber
        arguments:
            - @my_super_service
        tags:
            - { name: doctrine.event_subscriber, connection: default }
</code></pre>

<p>And to finish, my service.yml is loaded in the bundle dependency injection extension.</p>

<p><strong>MyBundle\DependencyInjection\MyBundleExtension</strong></p>

<pre><code>[...]

    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this-&gt;processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader-&gt;load('services.yml');
    }
[...]
</code></pre>

<p>My question is simple : Am I missing something ? </p>