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

Usage with alternate EntityManager (via: SwissEngine/Doctrine-Module-Extension) #46

Open
stephaun opened this issue Jun 16, 2015 · 1 comment

Comments

@stephaun
Copy link

This module ignores the --em=orm_alterante flag provided by SwissEngine/Doctrine-Module-Extension.

After a little debugging this is because the EntityManager is set in the "loadCli.post" event, before the CLI Helper even is made aware of the alternate EntityManager.

I have come up with a quick hack of a solution: Load the EntityManager from the CLI Helper inside the execute() { } function

ie, change:

public function execute(InputInterface $input, OutputInterface $output)
{
        $loader = new ServiceLocatorAwareLoader($this->serviceLocator);
        $purger = new ORMPurger();
        // etc...

to:

public function execute(InputInterface $input, OutputInterface $output)
{
        $em = $this->getHelper('em')->getEntityManager();
        $this->setEntityManager($em);
        $loader = new ServiceLocatorAwareLoader($this->serviceLocator);
        $purger = new ORMPurger();
        // etc  ....
@stephaun
Copy link
Author

Sorry everyone, I am still relatively new and don't really know how to make an official pull/push/fork request....

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

1 participant