Skip to content

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

@stephaun

Description

@stephaun

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  ....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions