fabpot/Silex — pull request #435 by GromNaN (2012-07-13 12:14:58+00:00)
Title: Add method Application::on($eventName, $callback, $priority)

This method is a shortcut to add a listener to the event dispatcher.

``` php
on(FormEvents::POST_BIND, function ($event) {
// ...
});
```

There is 2 added features :
- The callback can be an array of (serviceId, method) to lazy-load listeners (like in PR #426)
- If the callback returns `FALSE`, then the event propagation is stopped. This is how jQuery works and simplify usage.

I've added the method in a trait, but it might be in the Application class.