public function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
     $configuration = $this->getMigrationConfiguration($input, $output);
     DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
     parent::execute($input, $output);
 }
 /**
  * @param string $entityManagerName
  * @return string
  */
 protected function wrapCommand($entityManagerName)
 {
     if (!$this->isVersionCompatible()) {
         throw new \RuntimeException(sprintf('"%s" requires doctrine-orm "%s" or newer', $this->getName(), $this->getMinimalVersion()));
     }
     DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $entityManagerName);
     $this->command->setApplication($this->getApplication());
     return $this->command;
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
     if ($input->getOption('shard')) {
         $connection = $this->getApplication()->getHelperSet()->get('db')->getConnection();
         if (!$connection instanceof PoolingShardConnection) {
             throw new \LogicException(sprintf("Connection of EntityManager '%s' must implements shards configuration.", $input->getOption('em')));
         }
         $connection->connect($input->getOption('shard'));
     }
     $configuration = $this->getMigrationConfiguration($input, $output);
     DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
     parent::execute($input, $output);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
     $em = $this->getHelper('em')->getEntityManager();
     $factory = new MetadataFactory();
     $metadatas = $factory->getAllMetadata($em);
     if (!empty($metadatas)) {
         // Create SchemaTool
         $tool = new SchemaTool($em);
         return $this->executeSchemaCommand($input, $output, $tool, $metadatas);
     } else {
         $output->writeln('No Metadata Classes to process.');
         return 0;
     }
 }
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
     return parent::execute($input, $output);
 }
Ejemplo n.º 6
0
 /**
  * @inheritdoc
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     parent::initialize($input, $output);
     DoctrineCommandHelper::setApplicationConnection($this->getApplication(), null);
 }