SHORT
I have an Event Observer that is triggered in AppBundleA. Even though I've registered the service in AppBundleB. Is this how services work? This is my first time using them.
LONG
I'm trying to implement the Before/After filters in my Symfony(v2.8) app using Event Subscribers:
- http://symfony.com/doc/2.8/event_dispatcher/before_after_filters.html
- http://symfony.com/doc/2.8/event_dispatcher.html#creating-an-event-subscriber
According to the example, I've registered the service globally in:
app/config/services.yml
The service worked and triggered correctly.
Next, I wanted to localize the service to a particular bundle so I moved the service registration to AppBundleB.
# AppBundleB\Resources\config\services.yml
services:
app.tokens.action_subscriber:
class: AppBundle\EventSubscriber\TokenSubscriber
arguments: ['%tokens%']
tags:
- { name: kernel.event_subscriber }
However, when I ran a controller function in AppBundleA, it triggered the service above.
I don't believe this is supposed to happen. Does anyone have any ideas? Let me know if you need any other information.
Symfony v2.8