1
私はSymfonyに問題があります。私はコントローラ用の工場を使用しようとしていますが、動作しません。Symfony3.2Cotroller工場
#services.yml
services:
app.foo_controller_factory:
class: Foo\Controller\DefaultControllerFactory
arguments:
container: '@service_container'
app.foo_controller:
class: Foo\Controller\DefaultController
factory_class: '@app.foo_controller_factory'
factory_method: create_service
#/routing.yml
foo_bar:
path: /foo
defaults: { _controller: app.foo_controller:indexAction }
問題は、アプリケーションが決してDefaultControllerFactoryを通過しないためです。
解決策は何ですか?
スイッチを変更する必要がありました。エラーメッセージが表示されます。 – Cerad
実際はちょっと面白いです。 factory_classとfactoryメソッドはS3で削除されましたが、エラーを投げるのではなく、フレームワークが工場を使わずにコントローラを作成するだけです。いずれにせよ、factory_を工場に置き換えてください:['@ app.foo_controller_factory'、 'create_service'] http://symfony.com/doc/current/service_container/factories.html – Cerad
ありがとうございます@セラード!あなたの提案は助けになりました。 – finder