Perform action on service while bundle registration in app

Go To StackoverFlow.com

0

I want to perform action on service (Menu service) while bundle registers itself in app. Symfony register all bundles on every request, so there should be an option to perform some actions as that time.

Any suggestions?

2012-04-04 19:57
by Maciej Pyszyński
Do you just want to run an action on each request or do you actually care that it's run during a bundle's registration - Elnur Abdurrakhimov 2012-04-04 20:03


1

Not really sure what you mean, but you can use some kernel events to do some customisation. Have look at the: http://symfony.com/doc/current/book/internals.html#kernel-request-event

Or, you can do some action during the service compilation using the CompilerPass. Here's an explaination about the COmpiler PASs: http://richardmiller.co.uk/2012/02/15/symfony2-service-container-compiler-passes/

2012-04-05 05:07
by Tuong Le
CompilerPass did the thing. It was about: 1. Have global modules menu in AdminBundle; 2. Some bundles should auto register in that menu;

I used tagged service with CompilerPas - Maciej Pyszyński 2012-04-05 14:13

Ads