I created a middleware/event subscriber to generalise a few security checks I need to perform on routes with a specific request attribute.
But in order to perform the required database query I need to get access to the authenticated user.
When I call $event->getRequest()->getUser()
it always returns null
even when the user is authenticated.
Where can I find more information about this?
And one more question: is using EventSubscribers
a good practice for my needs?
Thanks in advance.