vipsoft / DoctrineDataFixturesExtension

Doctrine Data Fixtures Extension for Behat
MIT License
21 stars 35 forks source link

Undefined index: migrations DoctrineDataFixturesExtension/Extension.php on line 90 #35

Closed tristanbes closed 10 years ago

tristanbes commented 10 years ago
Undefined index: migrations in vendor/vipsoft/doctrine-data-fixtures-extension/src/VIPSoft/DoctrineDataFixturesExtension/Extension.php on line 90

When using :

VIPSoft\DoctrineDataFixturesExtension\Extension:
            lifetime:    feature
            autoload:    false
            directories:
                - apps/features/Context/Fixtures
            fixtures:    ~

solutions

define the key

VIPSoft\DoctrineDataFixturesExtension\Extension:
            lifetime:    feature
            autoload:    false
            directories:
                - apps/features/Context/Fixtures
            fixtures:    ~
            migrations: ~

either to move the parameter to the if structure:

    /**
     * {@inheritdoc}
     */
    public function load(ContainerBuilder $container, array $config)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/Resources/config'));
        $loader->load('services.xml');

        if (isset($config['migrations'])) {
            $config['migrations'] = (array) $config['migrations'];

            if (!class_exists('Doctrine\DBAL\Migrations\Migration')) {
                throw new \RuntimeException('Configuration requires doctrine/migrations package');
            }
            $container->setParameter('behat.doctrine_data_fixtures.migrations', $config['migrations']);
        }

        $container->setParameter('behat.doctrine_data_fixtures.autoload', $config['autoload']);
        $container->setParameter('behat.doctrine_data_fixtures.directories', $config['directories']);
        $container->setParameter('behat.doctrine_data_fixtures.fixtures', $config['fixtures']);
        $container->setParameter('behat.doctrine_data_fixtures.lifetime', $config['lifetime']);
        $container->setParameter('behat.doctrine_data_fixtures.use_backup', $config['use_backup']);
    }

or set as defaultNull on the extension configuration

robocoder commented 10 years ago

Thanks.