I try use knpMenuBundle in symfony 4
I render {{ knp_menu_render('App:MenuBuilder:menuTags') }}
class is in src/ App\Menu\MenuBuilder
get
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?").
Second i try use it as service -
{{ knp_menu_render('App\Menu\Builder:menuTags') }}
dont work...
i can inject this auto register service to other controller .
i read in packagist -
KnpMenuBundle v2.2.1
require:
symfony/framework-bundle: ~2.7|~3.0 | ^4.0
so it should work - in official symfony Documentation any information about symfony 4
https://symfony.com/doc/master/bundles/KnpMenuBundle/menu_service.html
I think remove APpBundle was a stupid way...
Any idea how i can use MenuBuilder ?
You can not use this "{{knp_menu_render ('App \ Menu \ Builder: menuTags')}}" to service. Use the alias of the service you created.
With Symfony 4 you need to use the menus as a service.
Try it out.
{{ knp_menu_render ('main') }}