Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony (3.4.2) - Error: Controller "fos_rest.exception.twig_controller" cannot be fetched from the container because it is private

I'm on an api project using FOSRestBundle on Symfony 3.4 and have some error when I want to use my own error messages. It says me:

Controller "fos_rest.exception.twig_controller" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"

I'm stuck on this error, I think a config is missing but I don't understand which one...

Thanks

like image 901
ScoobyDam Avatar asked Jan 09 '18 15:01

ScoobyDam


1 Answers

I found the solution: Add to your config.yml, in fos_rest:

fos_rest:
    //
    exception:
        //
        exception_controller: 'fos_rest.exception.controller:showAction'
like image 111
ScoobyDam Avatar answered Nov 08 '22 10:11

ScoobyDam