symfony/symfony — Issue #3488: [DoctrineBundle] Problems with running multiple doctrine1 commands
Author: matthiasnoback
Created: 2012-03-02 13:46:32+00:00
State: open

I encountered some problems when trying to run multiple Doctrine commands in a row (in my case: drop db, create db, create schema), from within a single PHP file (in my case a bootstrap file for PHPUnit tests), see the complete example on http://php-and-symfony.matthiasnoback.nl/2011/10/symfony2-use-a-bootstrap-file-for-your-phpunit-tests-and-run-some-console-commands/)

It appeared the doctrine:database:create command unsets the "dbname" param and the doctrine:database:drop command does not close the connection it creates. This results in a failure for the last command in row: doctrine:schema:create:

SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected

In a few minutes I will attach some code proposing some simple fixes for this problem. When approved, I will also request to pull these fixes in the DoctrineBundle for version 2.1