-
Notifications
You must be signed in to change notification settings - Fork 708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twig is required unnecessary #1887
Comments
but is this service used when Twig is not available ? |
I dont think so,
|
Which version of FOSRestBundle do you use? |
And what does your config look like? |
symfony 3.4.8, fosrest 2.3.1, twig removed from dependencies # FOS Rest
fos_rest:
exception:
enabled: true
exception_controller: 'fos_rest.exception.controller:showAction' |
Might be related : #1772 |
I have the same problem. Fix is available in #1945. Would be nice if it would get merged. |
…lating/twig is not enabled (Tobion) This PR was squashed before being merged into the 2.5-dev branch (closes #2012). Discussion ---------- Fix removal of fos_rest.exception.twig_controller when templating/twig is not enabled Fixes #1772, #1887, #1945, #2002 With that you can remove ``` framework: templating: engines: twig ``` which fixes the deprecations and it will use `\FOS\RestBundle\Controller\ExceptionController` instead of `\FOS\RestBundle\Controller\TwigExceptionController` correctly. This in turn means it does not use the TwigBundle error rendering but the implementation using the Serializer (Symfony or JMS). But the error response stays the same because of `\FOS\RestBundle\Serializer\Normalizer\ExceptionHandler::convertToArray` (or the equivalent for Symfony serializer). So people can disable templating and twig and it should still be BC. If people use TwigBundle but want to disable SF templating part to get rid of deprecations, they need to set ``` fos_rest: exception: exception_controller: 'fos_rest.exception.controller::showAction' ``` because otherwise the unwanted twig controller get's used again: https://github.com/FriendsOfSymfony/FOSRestBundle/blob/6013d5131f94cd7367c423e52bdfb83c4f0613f9/DependencyInjection/FOSRestExtension.php#L360-L367 Commits ------- a2c8639 Fix removal of fos_rest.exception.twig_controller when templating/twig is not enabled
Hi, I think
twig
dependency should be moved from require-dev to require or made optional some way.Even if we use custom exception controller, there is registered service
fos_rest.exception.twig_controller
with dependency totemplating.engine.twig
.It would be nice if twig will not be required to use fosrest 😄
The text was updated successfully, but these errors were encountered: