FOS/RestBundle 升级后报错如下:
"message": "Service \"App\\Service\\MySpeechService\" not found: even though it exists in the app's container, the container inside \"App\\Controller\\MySpeechController\" is a smaller service locator that only knows about the \"doctrine\", \"form.factory\", \"fos_rest.view_handler\", \"http_kernel\", \"parameter_bag\", \"request_stack\", \"router\", \"security.authorization_checker\", \"security.csrf.token_manager\", \"security.token_storage\", \"serializer\", \"session\", \"templating\" and \"twig\" services. Try using dependency injection instead.",
将在/config/service.yml中的
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
修改为:
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
calls:
- [setContainer, ["@service_container"]]
即可