How would you add an event listener (in my case it's a doctrine event) dynamically to the kernel without using services.yml pattern?
相关问题
- Symfony2 Set Controller in the kernelControllerEve
- Webpack Encore: cannot import local dependencies
- Render custom attribute KNP Menu
- Problems with cap deploy a symfony2 project, can
- Allow CORS on symfony 4
相关文章
- Symfony : Doctrine data fixture : how to handle la
- Symfony is linked to the wrong PHP version
- Symfony2: check whether session exists or not
- Is there a way to modify the entity mapping config
- symfony2 form choice and mongodb
- Get random records with Doctrine
- Symfony 3.1 and OneUpUploaderBundle + Blueimp = Up
- Doctrine not finding data on Google App Engine?
I found the answer myself after doing some digging into the vendor directory and
appProdProjectContainer.php
file. If you want your events to be registered with event manager you have to specify the tags in yourservices.yml
for the events that you want this to trigger for like:Now if you want to dynamically register these events, you need to leave the
event_listener
resource inservices.yml
, but delete the tags part and dynamically add them that as follow: