0
votes

I'm trying out Symfony but I'm running into some problems after I decided I wan't to test Migrations.

From the docs I learn I have to add this to the composer json.

"doctrine/doctrine-migrations-bundle": "dev-master",

So this is what I have now:

"require": {
        "php": ">=5.3.3",
        "symfony/symfony": "~2.4",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "~1.2",
        "doctrine/doctrine-migrations-bundle": "dev-master",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~2.3",
        "sensio/framework-extra-bundle": "~3.0",
        "sensio/generator-bundle": "~2.3",
        "incenteev/composer-parameter-handler": "~2.0"
    },

But this isn't working. It cannot find the right version.

This is the error:

Problem 1 - Installation request for doctrine/doctrine-migrations-bundle dev-master -> satisfiable by doctrine/doctrine-migrations-bundle[dev-master]. - doctrine/doctrine-migrations-bundle dev-master requires doctrine/migrations * -> no matching package found.

Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.

After this and a lot of googling (https://github.com/doctrine/DoctrineMigrationsBundle/issues/54) and trying I tried to set the version for "doctrine/doctrine-bundle": "~1.2", to require the aplha version. This did continue the installation but introduces a new problem.

After adding this line to the app kernel into the $bundles array:

new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),

I try to run this in the terminal: php app/console doctrine:migrations:status

But it gives me the following error:

Fatal error: Class 'Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand' not found in /Applications/MAMP/htdocs/symfony/vendor/doctrine/doctrine-migrations-bundle/Doctrine/Bundle/MigrationsBundle/Command/MigrationsLatestDoctrineCommand.php on line 30

Right now I really don't know what I'm missing. I have no clue how to get this working. I hope someone can give me a push in the right direction! Thanks!

2

2 Answers

4
votes

If you want to install the doctrine/doctrine-migrations-bundle you are also required to install doctrine/migrations. Based on your copy/paste of you composer.json, you forgot to add it.

Try with the following :

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "~2.4",
    "doctrine/orm": "~2.2,>=2.2.3",
    "doctrine/doctrine-bundle": "~1.2",
    "doctrine/migrations" : "dev-master",
    "doctrine/doctrine-migrations-bundle" : "dev-master",
    "twig/extensions": "~1.0",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~2.3",
    "sensio/framework-extra-bundle": "~3.0",
    "sensio/generator-bundle": "~2.3",
    "incenteev/composer-parameter-handler": "~2.0"
},

You are getting this error :

Fatal error: Class 'Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand' not found in /Applications/MAMP/htdocs/symfony/vendor/doctrine/doctrine-migrations-bundle/Doctrine/Bundle/MigrationsBundle/Command/MigrationsLatestDoctrineCommand.php on line 30

because doctrine/migrations has not been downloaded and several classes are missing for the doctrine/doctrine-migrations-bundle.

1
votes

You should check https://packagist.org/packages/doctrine/doctrine-migrations-bundle and try installing the latest version. Specifying more exact versions is better for overall stability as a composer update that gets the most up to date packages may have cause and effect on the stability of your application.