Doctrine migrations not using specified configuration

I have been using Doctrine and Migrations in my ZF2 project for a few weeks without issue. I have been executing migrations by specifying my own configuration file:

vendor/bin/doctrine-module migrations:diff --configuration=/path/to/migrations-config.xml

I recently brought in Codeception into my project via composer and when I recently went to execute a new migration (with the same above command), I received the following error:

[InvalidArgumentException]
Migrations directory data/DoctrineORMModule/Migrations does not exist

This is not the directory I have specified in my configuration file. At first I thought Doctrine Migrations was completely ignoring my --configuration argument. When I traced it through, I saw that Doctrine Migrations wasn't using my --configuration argument because it had already loaded a config file.

Would anyone know where this config file may be pulling in from? I can work around the issue for the time being by commenting out the conditional in AbstractCommand getMigrationConfiguration(), but long term I'd rather not have to rely on this. I'll also try and remove codeception and see if that has any impact. Any help is appreciated.

Answers


As it turns out, I was able to move Doctrine migrations configuration into my ZF2 module config. In my module.config.php, I have the following specified (Api is the module name):

'doctrine' => array(
        'driver' => array(
            'application_entities' => array(
                'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                'cache' => 'array',
                'paths' => array(__DIR__ . '/../src/Api/Entity')
            ),
            'orm_default' => array(
                'drivers' => array(
                    'Api\Entity' => 'application_entities'
                )
            )
        ),
        'migrations_configuration' => array(
            'orm_default' => array(
                'directory' => 'data/migrations',
                'namespace' => 'My\Namespace\Migrations',
                'table' => 'migrations',
            ),  
        ),
    ),

This allows me to run Doctrine migrations commands without having to specify a configuration file, for example:

vendor/bin/doctrine-module migrations:diff

I see an alternative in using a stand-alone doctrine-migration.phar command:

php doctrine-migrations.phar migrations:migrate --configuration=config.xml --db-configuration=db-config.xml

To make this work, you need to download doctrine-migrations.phar from here: https://github.com/doctrine/migrations


Need Your Help

How to shut a Win app from another app without reboot?

windows visual-studio-2010 winapi visual-c++ win32-process

Hi I want to make a small test window app that can force IE to save its data and shutdown upon a button click and restart with same tabs when another button is clicked??

Javascript login using cURL in bash script

javascript bash http curl libcurl

I am trying to write a bash script in which I need to login to a website which uses javascript in its form. I have never used cURL so any help would be appreciated. I know I need to use cookies and I