Fix mongodb doctrine listener

This commit is contained in:
Tim Nagel 2015-01-04 20:16:32 +11:00
commit 7fac93ff8b
2 changed files with 18 additions and 9 deletions

View file

@ -9,8 +9,11 @@ https://github.com/FriendsOfSymfony/FOSElasticaBundle/commit/XXX where XXX is
the commit hash. To get the diff between two versions, go to
https://github.com/FriendsOfSymfony/FOSElasticaBundle/compare/v3.0.4...v3.1.0
* 3.1.0
* 3.1.0 (Unreleased)
* BC BREAK: `DoctrineListener#scheduleForDeletion` access changed to private.
* BC BREAK: `ObjectPersisterInterface` gains the method `handlesObject` that
returns a boolean value if it will handle a given object or not.
* BC BREAK: `Doctrine\Listener#scheduleForDeletion` access changed to private.
* BC BREAK: `ObjectPersisterInterface` gains the method `handlesObject` that
returns a boolean value if it will handle a given object or not.
* Removed `Doctrine\Listener#getSubscribedEvents`. The container
configuration now configures tags with the methods to call to avoid loading
this class on every request where doctrine is active.

View file

@ -473,14 +473,20 @@ class FOSElasticaExtension extends Extension
$listenerDef->replaceArgument(3, new Reference($typeConfig['listener']['logger']));
}
$tagName = null;
switch ($typeConfig['driver']) {
case 'orm':
foreach ($this->getDoctrineEvents($typeConfig) as $event) {
$listenerDef->addTag('doctrine.event_listener', array('event' => $event));
}
$tagName = 'doctrine.event_listener';
break;
case 'mongodb': $listenerDef->addTag('doctrine_mongodb.odm.event_subscriber'); break;
case 'mongodb':
$tagName = 'doctrine_mongodb.odm.event_listener';
break;
}
if ($tagName) {
foreach ($this->getDoctrineEvents($typeConfig) as $event) {
$listenerDef->addTag($tagName, array('event' => $event));
}
}
$container->setDefinition($listenerId, $listenerDef);