New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EventDispatcher] no interface for event #9539
Comments
An event is a value object, this is why Symfony does not define an interface for it |
Thanks for the answer. Guess I'll rely on concrete classes when dispatching events. I never saw events as value objects, but it does make sense to threat them that way. |
removed the interface see symfony/symfony#9539
well, the event is a value object passing the data to the listener. Note that as of Symfony 2.4 (currently master), the event listener will receive 3 arguments: the event object, the event name and the dispatcher. In previous versions, you have to get the event name and the dispatcher from the event object (which is something we want to drop in 3.0, hence the new arguments) |
Is there a reason why there is no interface for the event class?
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/EventDispatcher/Event.php
An example
This makes it impossible to do the code below
Since there is no Event Interface the code above is not possible and without it we don't provide the public methods of the event class. Is there a good reason symfony does not provide this interface class? Should we not rely on interfaces when dispatching an event?
The text was updated successfully, but these errors were encountered: