I am trying to figure out how to redirect to a specific page (which in my case is a payment page) for a user who does not have a valid subscription.
I know that I can do this by putting the isGranted test request in all my actions, but I don’t like this solution, because it seems like a big waste of time, given the number of actions that I have.
I looked through the parameters of firewall.access_denied_url, but I do not want to bind AccessDenied to the payment page, because, for example, access to the administrator page is denied to any user who does not have ROLE_ADMIN, and redirecting to the payment page does not make any sense.
I already have a voter that checks if the user is valid or not and grants access in this case, but how can I use this voter when the user tries to reach a specific template and redirect him / her when access is denied?
Thanks in advance!
source
share