I encountered a problem with the console, I would have liked to be able to pass several instances of the entity manager.
Currently, only one instance can be passed using SingleManagerProvider class.
Here is a new implementation of the MultipleManagerProvider class.
It allows you to obtain several instances of the Entity manager within a console application.
Here is how it could be instantiated:
#!/usr/bin/env php
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Console\EntityManagerProvider\MultipleManagerProvider;
$em1 = GetEntityManager();
$em2 = GetEntityManager();
$commands = [
// If you want to add your own custom console commands,
// you can do so here.
];
$multipleManagerProvider = new MultipleManagerProvider(['em1' => $em1, 'em2' => $em2]);
ConsoleRunner::run($multipleManagerProvider, $commands);
It's now possible to execute the binary with the argument --em=em1or --em=em2
Hi,
I encountered a problem with the console, I would have liked to be able to pass several instances of the entity manager. Currently, only one instance can be passed using
SingleManagerProvider
class.Here is a new implementation of the
MultipleManagerProvider
class. It allows you to obtain several instances of theEntity manager
within a console application.Here is how it could be instantiated:
It's now possible to execute the binary with the argument
--em=em1
or--em=em2