How to install DoctrineMigrationsBundle using composer in symfony 2.1.4

on

I want to install DoctrineMigrationsBundle in my project, but I couldn’t find any documentation to install the bundle using composer.json. I spend few hours to find the way of installation. So Let’s see how to do that.

DoctrineMigrationsBundle offers well and safe way to deploy new versions of your database schema. Find the corresponding documentation over here. So I tried below code to install the doctrine-migrations-bundle, but it was failed.

What I tried  to install DoctrineMigrationsBundle!

{
    "require": {
        "doctrine/doctrine-migrations-bundle": "dev-master"
    }
}

What was the issue ?

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.

Above message clearly says doctrine-migrations-bundle required migrations. We also need to add that package in composer.json in require section.

Solution and Configuration

Step 1: Append it in composer.json require section.

{
    "require": {
	"doctrine/migrations": "dev-master",
        "doctrine/doctrine-migrations-bundle": "dev-master"
    }
}

Step 2: Now see the all goes green in your terminal.

php composer.phar update

Step 3: Configure in app/AppKernel.php.

// ...
 public function registerBundles()
 {
 $bundles = array(
 // ...
 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
 // ...
 );
 // ...
 }

That’s all we done with installation DoctrineMigrationsBundle.

I have already answered similar question in Stack Overflow  install DoctrineFixturesBundle and doctrine-fixtures in Symfony 2.1.4. Make it use if you need.

Hope this post helps you. Your all useful feedback’s are welcome.

 

Posted in Symfony2 and tagged , by .

About Gowri

I am professional web developer with 8+ years experience. PHP, jQuery, WordPress, Angular and Ionic are my key skills in web development. I am working with strong enthusiastic team with spirit. We provide all web related solution like HTML/CSS development, Web graphic design and Logo.

2 thoughts on “How to install DoctrineMigrationsBundle using composer in symfony 2.1.4

  1. yavor99

    Dude, this does not work in Symfony 2.1.7. I install the bundle successfully but Symfony can not load it. Can you help?

    D:\xampp\htdocs\symblog.dev>php app/console doctrine:migrations:diff

    Fatal error: Class 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' not found in D:\xampp\htdocs\symblog.dev\app\
    AppKernel.php on line 23

    1. Gowri Post author

      I think you have not installed DoctrineFixturesBundle. Please Install and check. I already answered how to install DoctrineFixturesBundle in Stack overflow. You can find the link in the bottom of post.

Comments are closed.