我尝试在symfony 4中使用knpMenuBundle
我呈现{{ knp_menu_render('App:MenuBuilder:menuTags') }}
类位于src/ App\MenuBuilder中。
到达
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的信息都应该有效。
我认为删除APpBundle是个愚蠢的方法..。
知道我怎么用MenuBuilder吗?
发布于 2018-05-27 08:41:31
不能使用此{{knp_menu_render ('App \ Menu \ Builder: menuTags‘)}}来服务。使用您创建的服务的别名。
使用Symfony 4,您需要使用菜单作为服务。
试一试。
{{ knp_menu_render ('main') }}https://stackoverflow.com/questions/50545266
复制相似问题