private function disableDoctrineListener(ContainerBuilder $container)
    {
        if (!$container->hasParameter('kernel.bundles')) {
            return;
        }
        $bundles = $container->getParameter('kernel.bundles');
        if (!isset($bundles['DoctrineBundle'])) {
            $container->prependExtensionConfig($this->getAlias(), array(
                'listeners' => array(
                    'clear_entity_managers' => false
                )
            ));
        }
    }