KnpLabs/KnpMenuBundle — Issue #95: Inject database into Knp Menu Bundle as a service
Author: matteopoile
Created: 2012-01-04 10:28:59+00:00
State: open

Hi,
I followed this documentation https://github.com/KnpLabs/KnpMenuBundle/blob/master/Resources/doc/menu_service.md to configure Knp Menu Bundle as a service and all works fine.

Now, from createMainMenu function, I'm trying to access my database to extract the information for my menu but I can't connect using $this->get('database_connection') as usual in a standard controller.

I saw in the tutorial that the request is injected in the service via service.yml, how can I inject also tha database?

Some code examples will be very appreciated.

Thanks in advance

Matteo

P.S.: You can see my code here http://forum.symfony-project.org/viewtopic.php?f=23&t=38644