Service or alias has been removed or inlined when the container was compiled
Opened this issue · 3 comments
Hi,
I'm using this bundle in a Symfony 4 app and am getting the following warning when clearing cache etc:
The "App\Application\EventListener\User\PasswordResetRequestedListener" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.
My event listener is wired up in services.yaml as follows:
App\Application\EventListener\User\PasswordResetRequestedListener:
class: App\Application\EventListener\User\PasswordResetRequestedListener
tags:
- { name: tactician.event_listener, event: App\Domain\Events\PasswordResetRequested }
My Tactician config is as follows:
tactician:
commandbus:
default:
middleware:
- tactician_domain_events.middleware.release_recorded_events
- tactician.middleware.locking
- tactician.middleware.doctrine
- tactician.middleware.command_handler
tactician_domain_event:
collect_from_all_managed_entities: true
I've done some searching and it seems to be related to Symfony 4 making services private by default. I don't want to override this for every event listener. Am I missing something in the config?
Thanks
I'm in the process of upgrading a project towards sf4 and hit the same error.
My services were previously private by default but I made my subscribers implement an interface and made them public via this
_instanceof:
App\EventListener\DomainEventSubscriberInterface:
public: true
tags:
- { name: tactician.event_subscriber }
But now, this does not seem to have the appropriate effect at the right moment. It could also very well be something else happening during this migration.
did you find a solutin @tmcnicholls ?
@borNfreee not yet, other than making the listeners explicitly public as a temporary measure like the below:
App\Application\EventListener\User\PasswordResetRequestedListener:
public: true
tags:
- { name: tactician.event_listener, event: App\Domain\Events\PasswordResetRequested }
Do you have any other ideas?
Thanks