doctrine migrations 2 + zend framework 2 = is it p

2020-07-13 12:01发布

问题:

I have used this guide http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/ and now I have a working Doctrine 2 + ZF2 software.

I use a versioning system and I want then use Doctrine MIGRATIONS tool to have a database migration system.

If I put on a shell ./doctrine-module orm:schema-tool:update it works correctly, but if I use a migration tools for example ./doctrine-module migrations:status the system give me an error:

[Doctrine\DBAL\Migrations\MigrationException]
Migrations namespace must be configured in order to use Doctrine migrations.

Which configurations are needs? Does DoctrineOrmModule support Doctrine migration?

I have found this for zf1 http://moxune.com/blog/2011/10/configure-doctrine-migrations-2-zend_config/

回答1:

If you check the current Travis CI CLI test for DoctrineORMModule you will notice that there's a --configuration parameter pointing to an XML configuration, as described in Doctrine Migrations documentation. Setting that parameter and having DoctrineORMModule configured correctly should allow you to use the CLI.