|
@@ -12,16 +12,7 @@
|
|
namespace Symfony\Bundle\DoctrineBundle\Command;
|
|
namespace Symfony\Bundle\DoctrineBundle\Command;
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\Command;
|
|
use Symfony\Bundle\FrameworkBundle\Command\Command;
|
|
-use Symfony\Component\Console\Input\ArrayInput;
|
|
|
|
-use Symfony\Component\Console\Input\InputArgument;
|
|
|
|
-use Symfony\Component\Console\Input\InputOption;
|
|
|
|
-use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
-use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
-use Symfony\Component\Console\Output\Output;
|
|
|
|
-use Symfony\Bundle\FrameworkBundle\Console\Application;
|
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
|
-use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
|
|
|
|
-use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
|
|
|
|
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
|
|
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;
|
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
|
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
|
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
|
@@ -30,33 +21,10 @@ use Doctrine\ORM\Tools\EntityGenerator;
|
|
/**
|
|
/**
|
|
* Base class for Doctrine console commands to extend from.
|
|
* Base class for Doctrine console commands to extend from.
|
|
*
|
|
*
|
|
- * Provides some helper and convenience methods to configure doctrine commands in the context of bundles
|
|
|
|
- * and multiple connections/entity managers.
|
|
|
|
- *
|
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
|
*/
|
|
*/
|
|
abstract class DoctrineCommand extends Command
|
|
abstract class DoctrineCommand extends Command
|
|
{
|
|
{
|
|
- /**
|
|
|
|
- * Convenience method to push the helper sets of a given entity manager into the application.
|
|
|
|
- *
|
|
|
|
- * @param string $emName
|
|
|
|
- */
|
|
|
|
- public function setApplicationEntityManager($emName)
|
|
|
|
- {
|
|
|
|
- $em = self::getEntityManager($emName);
|
|
|
|
- $helperSet = $this->getApplication()->getHelperSet();
|
|
|
|
- $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
|
|
|
|
- $helperSet->set(new EntityManagerHelper($em), 'em');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public function setApplicationConnection($connName)
|
|
|
|
- {
|
|
|
|
- $connection = $this->getDoctrineConnection($connName);
|
|
|
|
- $helperSet = $this->getApplication()->getHelperSet();
|
|
|
|
- $helperSet->set(new ConnectionHelper($connection), 'db');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
protected function getEntityGenerator()
|
|
protected function getEntityGenerator()
|
|
{
|
|
{
|
|
$entityGenerator = new EntityGenerator();
|
|
$entityGenerator = new EntityGenerator();
|