Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Symfony2 DIC: add a Doctrine Listener Subscription
<parameters>
<parameter key="doctrine_extensions.orm.sluggable.class">DoctrineExtensions\Sluggable\ORM\Listener</parameter>
</parameters>
<service id="doctrine_extensions.addSubscribers" class="Bundle\DoctrineExtensionsBundle\DoctrineExtensionsBundle" shared="true" factory-method="addSubscriber">
<argument type="service" id="doctrine.dbal.default_connection.event_manager" />
<argument type="service" id="doctrine_extensions.orm.sluggable.listener">%doctrine_extensions.orm.sluggable.class%</argument>
</service>
class DoctrineExtensionsBundle extends BaseBundle
{
public static function addSubscriber($eventManager, EventSubscriber $subscriber)
{
return $eventManager->addSubscriber($subscriber);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment