Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access request in a menu listener #182

Closed
maxailloud opened this issue Apr 11, 2013 · 4 comments
Closed

Access request in a menu listener #182

maxailloud opened this issue Apr 11, 2013 · 4 comments

Comments

@maxailloud
Copy link

Hello,

I am using this technic to make my menu.

I would like to access the request in the listener to check the route, and make some action if the route match some predefined routes.

I succeed to inject the requets in my listener, but I got this error:

InactiveScopeException: You cannot create a service ("maxime_movie.menu.admin.listener") of an inactive scope ("request").

I don't understand why I got this exception, and why even if I got this I can use the request in my listener.
I tried using "strict=false" in my services.xml but it didn't work.

It's a workaround for making a breadcrumb, waiting for a better solution with a BreadCrumbRenderer (see KnpLabs/KnpMenu#45 ).

@stof
Copy link
Collaborator

stof commented Apr 11, 2013

Can you paste the stack trace of the exception ?

@maxailloud
Copy link
Author

Sorry for the delay, here is the stack trace:

  • in /home/maxime/workspace/MaxSite/app/cache/dev/appDevDebugProjectContainer.php line 1307
  • at appDevDebugProjectContainer->getMaximeMovie_Menu_Admin_ListenerService() in /home/maxime/workspace/MaxSite/app/bootstrap.php.cache line 129
  • at Container->get('maxime_movie.menu.admin.listener') in /home/maxime/workspace/MaxSite/app/cache/dev/classes.php line 3498
  • at ContainerAwareEventDispatcher->lazyLoad('maxime.menu_configure.admin.aside') in /home/maxime/workspace/MaxSite/app/cache/dev/classes.php line 3463
  • at ContainerAwareEventDispatcher->getListeners(null) in /home/maxime/workspace/MaxSite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 107
  • at TraceableEventDispatcher->getListeners() in /home/maxime/workspace/MaxSite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 168
  • at TraceableEventDispatcher->getNotCalledListeners() in /home/maxime/workspace/MaxSite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 354
  • at TraceableEventDispatcher->saveInfoInProfile(object(Profile), false) in /home/maxime/workspace/MaxSite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 328
  • at TraceableEventDispatcher->updateProfiles('e0d9a1e1793955a5497ff85280923eee5ee82e11', false) in /home/maxime/workspace/MaxSite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 432
  • at TraceableEventDispatcher->postDispatch('kernel.terminate', object(PostResponseEvent)) in /home/maxime/workspace/MaxSite/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 148
  • at TraceableEventDispatcher->dispatch('kernel.terminate', object(PostResponseEvent)) in /home/maxime/workspace/MaxSite/app/bootstrap.php.cache line 985
  • at HttpKernel->terminate(object(Request), object(Response)) in /home/maxime/workspace/MaxSite/app/bootstrap.php.cache line 391
  • at Kernel->terminate(object(Request), object(Response)) in /home/maxime/workspace/MaxSite/web/app_dev.php line 28

And the listener and the services.xml files are:

@stof
Copy link
Collaborator

stof commented Apr 16, 2013

Looks like you are facing symfony/symfony#7356

@maxailloud
Copy link
Author

I wasn't sure of that so I open a new issue on the knpMenuBundle, just in case I made something wrong.

Thanks anyway.

@Nek- Nek- closed this as completed Jul 4, 2014
EmmanuelVella pushed a commit to EmmanuelVella/KnpMenuBundle that referenced this issue Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants