4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\EventDispatcher;
15 * Event is the base class for classes containing event data.
17 * This class contains no event data. It is used by events that do not pass
18 * state information to an event handler when an event is raised.
20 * You can call the method stopPropagation() to abort the execution of
21 * further listeners in your event listener.
23 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
24 * @author Jonathan Wage <jonwage@gmail.com>
25 * @author Roman Borschel <roman@code-factory.org>
26 * @author Bernhard Schussek <bschussek@gmail.com>
31 * @var bool Whether no further event listeners should be triggered
33 private $propagationStopped = false;
36 * @var EventDispatcherInterface Dispatcher that dispatched this event
41 * @var string This event's name
46 * Returns whether further event listeners should be triggered.
48 * @see Event::stopPropagation()
50 * @return bool Whether propagation was already stopped for this event
52 public function isPropagationStopped()
54 return $this->propagationStopped;
58 * Stops the propagation of the event to further event listeners.
60 * If multiple event listeners are connected to the same event, no
61 * further event listener will be triggered once any trigger calls
64 public function stopPropagation()
66 $this->propagationStopped = true;
70 * Stores the EventDispatcher that dispatches this Event.
72 * @param EventDispatcherInterface $dispatcher
74 * @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.
76 public function setDispatcher(EventDispatcherInterface $dispatcher)
78 $this->dispatcher = $dispatcher;
82 * Returns the EventDispatcher that dispatches this Event.
84 * @return EventDispatcherInterface
86 * @deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.
88 public function getDispatcher()
90 @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event dispatcher instance can be received in the listener call instead.', E_USER_DEPRECATED);
92 return $this->dispatcher;
96 * Gets the event's name.
100 * @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.
102 public function getName()
104 @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event name can be received in the listener call instead.', E_USER_DEPRECATED);
110 * Sets the event's name property.
112 * @param string $name The event name
114 * @deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.
116 public function setName($name)