2017-05-10 2 views
1

私はカスタムコントローラ(Sonata \ AdminBundle \ Controller \ CRUDControllerを拡張)とアクションを作成します。SonataAdminBundleテンプレートでレンダー(コントローラ)を使用できません

このアクション{{render(controller('MainBundle:SonataAdmin/Order:searchCertificate'))}}

をレンダリングするとき、私はsymfonyのエラーを取得:

An exception has been thrown during the rendering of a template ("There is no _sonata_admin defined for the controller MainBundle\Controller\SonataAdmin\OrderController and the current route").

答えて

1

私は公式documentationで答えを見つけた:

If you want to render a custom controller action in a template by using the render function in twig you need to add _sonata_admin as an attribute. For example; {{ render(controller('AppBundle:XxxxCRUD:comment', {'_sonata_admin': 'sonata.admin.xxxx' })) }}. This has to be done because the moment the rendering should happen the routing, which usually sets the value of this parameter, is not involved at all, and then you will get an error "There is no _sonata_admin defined for the controller AppBundleControllerXxxxCRUDController and the current route ' '."

関連する問題