Doctrine\DBAL\Migrations\Migration::setNoMigrationException PHP Method

setNoMigrationException() public method

public setNoMigrationException ( boolean $noMigrationException = false )
$noMigrationException boolean Throw an exception or not if no migration is found. Mostly for Continuous Integration.
    public function setNoMigrationException($noMigrationException = false)
    {
        $this->noMigrationException = $noMigrationException;
    }

Usage Example

 /**
  * @Route("/{connectionName}/execute/{version}")
  * @Method("POST")
  */
 public function executeAction($connectionName, $version)
 {
     $connection = $this->getDoctrine()->getConnection($connectionName);
     $outputWriter = new MemoryOutputWriter();
     $configuration = new Configuration($connection);
     $configuration->setName($this->container->getParameter('doctrine_migrations.name'));
     $configuration->setOutputWriter($outputWriter);
     $configuration->setMigrationsTableName($this->container->getParameter('doctrine_migrations.table_name'));
     $configuration->setMigrationsDirectory($this->container->getParameter('doctrine_migrations.dir_name'));
     $configuration->setMigrationsNamespace($this->container->getParameter('doctrine_migrations.namespace'));
     $migration = new Migration($configuration);
     $currentVersion = $configuration->getCurrentVersion();
     $dryRun = false;
     $migration->setNoMigrationException(true);
     $sql = $migration->migrate($version, $dryRun, true);
     return $this->render('MarkeiDoctrineMigrationWebBundle:Migrate:execute.html.twig', ['connectionName' => $connectionName, 'to' => $version, 'from' => $currentVersion, 'output' => $outputWriter->getMemory(), 'name' => $this->container->getParameter('doctrine_migrations.name')]);
 }
All Usage Examples Of Doctrine\DBAL\Migrations\Migration::setNoMigrationException