-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Hello!
I was wondering about priority problems in FrameworkBundle in Symfony 2.8 at least.
Both of them listen on kernel.request but RouterListener has a 32 priority and AddRequestFormatsListener has no priority set (so, it means 0).
Because of this priority, when the RouterListener throw an exception as NotFoundHttpException or MethodNotAllowedHttpException for example, it has no knowledge about custom format specified in framework configuration.
If I add custom mime types as explained in:
http://symfony.com/doc/current/cookbook/request/mime_type.html
Then if I want to implement an HttpExceptionListener that convert exception message in a custom mime type from an Accept Header, I'm stuck. If this Listener need to convert RouterException, its priority need to be above 32 but if I want to know my custom mime types to know that 'application/vnd.v1+json' is json format, priority need to be below 0. (p > 32 and p < 0 impossible)
I'll go for the FosRestBundle solution, creating a MimeTypeListener with a high priority but I thought it is redundant.
https://github.com/FriendsOfSymfony/FOSRestBundle/blob/1.8.0/Resources/config/mime_type_listener.xml
I would know if there was a reason that prevents to rise the AddRequestFormatsListener priority.