我试着在symfony 4中使用knpMenuBundle
我渲染
{{knp_menu_render('App:MenuBuilder:menuTags')}
类在src中/
应用程序\菜单\菜单生成器
收到
An exception has been thrown during the rendering of a template ("Bundle "App" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your App\Kernel.php file?").
第二,我试着把它用作服务-
{{ knp_menu_render('App\Menu\Builder:menuTags') }}
不工作。。。
我可以将这个自动注册服务注入其他控制器。
我读过《包装师》-
KnpMenuBundle v2.2.1
require:
symfony/framework-bundle: ~2.7|~3.0 | ^4.0
因此,它应该是有效的——在symfony官方文档中,任何关于symfony 4的信息
https://symfony.com/doc/master/bundles/KnpMenuBundle/menu_service.html
我认为删除APpBundle是一种愚蠢的方式。。。
知道我如何使用MenuBuilder吗?