symfony/symfony-docs — pull request #2817 by johnkary (2013-07-11 17:10:55+00:00)
Title: EventDispatch implements the Mediator pattern, not the Observer pattern

Anthony Ferrara @ircmaxell does a great job of pointing out the differences between the Mediator and Observer pattern in his blog post [Handling Plugins In PHP](http://blog.ircmaxell.com/2012/03/handling-plugins-in-php.html).

The two patterns appear very similar but differ in which object does the event emitting:

An implementation of the Observer pattern would allow *each* object/entity/service to individually allow subscribing to its events and it would notify all listeners itself: `OrderPersister->notify('order.create', $order)`

But a Mediator pattern implementation would be like the Symfony EventDispatcher object that is centrally-configured with listeners and then notifies those listeners of events on behalf of its external collaborators: Inside a controller `$this->persister->create($order);` then inside Persister::create() -- `$this->dispatcher->notify('order.create', $order)`