DoctrineDataFixtureModule
DoctrineDataFixtureModule copied to clipboard
Usage with alternate EntityManager (via: SwissEngine/Doctrine-Module-Extension)
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 ....
Sorry everyone, I am still relatively new and don't really know how to make an official pull/push/fork request....