How can I run the doctrine 2 migration command line without interaction?

How can I run the doctrine 2 migration command without interaction?

Currently, I have the following command that runs when setting up my unit tests. But it always asks for user input Yes / No, even when I use the -no-interaction option.

$input = new Symfony\Components\Console\Input\ArrayInput( array( 'migrations:migrate', '--configuration' => APPLICATION_PATH . '/../doctrine/migrations.xml', '--no-interaction', ) ); $cli->run($input); 
+7
php unit-testing phpunit zend-framework doctrine
source share
2 answers

I just stumbled upon your post since I had the same problem. It seems that the doctrine of migration has been updated (I suppose: https://github.com/doctrine/migrations/commit/5b2751f149bc38d38870578f753c2193eb36e742 ).

Consequently

  php app/console --no-interaction doctrine:migrations:migrate 

now works fine.

+19
source share

I don't like Tom's approach, and there is another way to do this:

 <?php $input = new Symfony\Components\Console\Input\ArrayInput( array( 'migrations:migrate', '--configuration' => APPLICATION_PATH . '/../doctrine/migrations.xml', ) ); $input->setInteractive(false); ?> 
+7
source share

All Articles