symfony/symfony — pull request #7792 by mpdude (2013-04-22 10:13:16+00:00)
Title: [RFC] An unobstrusive EventDispatcher (not before 3.0)

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | yes
| Deprecations? | yes
| Tests pass? | not yet
| Fixed tickets | n/a
| License | MIT
| Doc PR | to-do

The idea of this PR is to separate the _how_ of Event propagation from the _what_ of Events.

Currently (2.x), client code has to inherit from Event to carry information about event propagation along. This is factored out into a separate class.

The benefit for client code is that POPOs (anything) can be used as the _Event_ and that these objects need not be aware of Event Dispatching at all. The object passed along as the Event is not modified during propagation, at least not from the Event Dispatcher system.

The new ```EventPropagation``` class is passed as the second argument to listeners. Besides stopping propagation, it allows to obtain both the ```EventDispatcher``` initially used to send off the Event (f. e. to trigger another one on the same channel) as well as the dispatcher a listener was registered with (in case a listener is multiply-subscribed and the dispatcher matters).

This is a spin-off from #7627 and we cannot get it before 3.0 due to API changes. Anyway, I'd like to start a discussion with it :-).