<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventInterface;
use Doctrine\Common\EventManager;
/**
* This EventDispatcher automatically gets the kernel listeners injected
* @author Fabien Potencier <fabien@symfony.com>
class ContainerAwareEventManager extends EventManager
{
protected $container;
* Constructor.
* @param ContainerInterface $container A ContainerInterface instance
public function __construct(ContainerInterface $container)
$this->container = $container;
}
public function registerKernelListeners(array $listeners)
$this->listeners = $listeners;
* {@inheritdoc}
public function notify(EventInterface $event)
foreach ($this->getListeners($event->getName()) as $listener) {
if (is_array($listener) && is_string($listener[0])) {
$listener[0] = $this->container->get($listener[0]);
call_user_func($listener, $event);
public function notifyUntil(EventInterface $event)
$ret = call_user_func($listener, $event);
if ($event->isProcessed()) {
return $ret;
public function filter(EventInterface $event, $value)
$value = call_user_func($listener, $event, $value);
return $value;