Reputation: 6206
Can I somehow configure a service/listener to not load/listen in certain environments?
I know I can inject the kernel.environment
in the service and check that in every method. However, that doesn't really seem elegant :)
Any thoughts?
Upvotes: 0
Views: 1680
Reputation: 1986
you can move the listener service to another config file, for example services_dev.yml and load it or not depending on the environment in you bundles extension class' load function in
...Bundle/DependencyInjection/...Extension.php
depending on how is your project configured as described here
Get Symfony2 environment in bundle Extension
Upvotes: 3