Reputation: 8467
I have an Event Listener that finds an entity object in the database an checks whether current user is authorized for it. I need this object further in Controller, so my question is: what is the best way to pass an object from Event listener to Controller?
I have several options, but none of them is good enough.
set()
object in Event Listener and get()
in Controller - but it looks like architectural flaw to assign service for such purposes.Maybe anyone has better solution?
Upvotes: 0
Views: 808
Reputation: 11351
An Event Listener is a service like any other service. You can save your object to a protected member of your service, create a getter for it and in the controller get this service and retrieve the objet using the getter
Upvotes: 1