KnpMenuBundle icon indicating copy to clipboard operation
KnpMenuBundle copied to clipboard

Deprecation Message in knp-menu-bundle/src/Provider/BuilderAliasProvider.php:104

Open Gemineye opened this issue 8 years ago • 2 comments

I see this Message after rendering a menu:

User Deprecated: Passing "false" as the second argument to Symfony\Component\HttpKernel\Kernel::getBundle() is deprecated as of 3.4 and will be removed in 4.0.

Gemineye avatar Dec 08 '17 09:12 Gemineye

We cannot easily avoid this deprecation warning without breaking support for bundle inheritance. I don't have an idea yet to avoid triggering it in case inheritance is not used (I'm not even sure it is possible).

Our code is already compatible with newer versions not supporting this attribute though.

stof avatar Dec 08 '17 10:12 stof

I was getting the same depreciation notice in 3.4 and was able to get rid of it. I was calling the menus in views using the following:

{{ knp_menu_render('AppBundle:Builder:dashboardAccountMenu', {'template': ':menu:menu.html.twig'}) }}

The Builder class was not registered as a Service. Following the documentation I registered MenuBuilder as a Service:

Creating Menu Builders as Services

And now calling menus as following (using menu alias):

{{ knp_menu_render('dashboard_account_menu', {'template': ':menu:menu.html.twig'}) }}

Hope this can help someone.

slunak avatar May 24 '18 10:05 slunak