*/
class EventManager extends BaseEventManager
{
/**
* Loads event listeners from the service container.
*
*
*
*
*
*
* @param TaggedContainerInterface $container The service container
* @param string $tagName The name of the tag to load
*/
public function loadTaggedEventListeners(TaggedContainerInterface $container, $tagName = 'doctrine.odm.mongodb.event_listener')
{
foreach ($container->findTaggedServiceIds($tagName) as $id => $instances) {
$events = array();
foreach ($instances as $attributes) {
if (isset($attributes['event'])) {
$events[] = $attributes['event'];
}
}
if (0 < count($events)) {
$this->addEventListener($events, $container->get($id));
}
}
}
/**
* Loads event subscribers from the service container.
*
*
*
*
*
* @param TaggedContainerInterface $container The service container
* @param string $tagName The name of the tag to load
*/
public function loadTaggedEventSubscribers(TaggedContainerInterface $container, $tagName = 'doctrine.odm.mongodb.event_subscriber')
{
foreach ($container->findTaggedServiceIds($tagName) as $id => $instances) {
$this->addEventSubscriber($container->get($id));
}
}
}