Jump to content

Modules in CLI mode doesn't have container instance


Recommended Posts

So I'm working out module command using Symfony Console Component in Prestashop 1.7.6.2.

I tried to deleted some entities for example customers and that of course invokes actionObjectCustomerDeleteBefore/actionObjectCustomerDeleteAfter hooks, the problem is that modules implementing these hooks in CLI mode doesn't have container instance so they can't get instance of EntityManager from the container. I managed to get EntityManager instance in command class by using dependency injection, however I'm not sure how I should pass it to the modules without using static variables, any suggestions would be appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...