Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service or alias has been removed or inlined when the container was compiled #13

Open
tmcnicholls opened this issue Nov 14, 2018 · 3 comments

Comments

@tmcnicholls
Copy link

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

@kermorgant
Copy link

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.

@maks-rafalko
Copy link
Owner

did you find a solutin @tmcnicholls ?

@tmcnicholls
Copy link
Author

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants