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.
- In Controller, using repository to fetch the same object from database second time - which is actually less coupled but produces additional DB query.
- Serializing object in Event Listener and passing it to Controller in request.
- Making a service that will
set()object in Event Listener andget()in Controller - but it looks like architectural flaw to assign service for such purposes.
Maybe anyone has better solution?