Migrations for eZ Publish/eZ Platform

Installs: 1 544

Dependents: 0

Stars: 15

Watchers: 5

Forks: 6

Open Issues: 0

3.0 2015-12-13 20:31 UTC


Latest Stable Version SensioLabsInsight License Gitter

Migrations for eZ Publish/Platform.


This bundle gives you an additional ezpublish:migrations:generate command, which generates a Migration that eases eZ Publish/Platform related changes

  • Automatically sets the active eZ user performing the changes (default: admin)
  • Allows the quick change of the currently active user, e.g. for creating new content in the name of a certain user.
  • Adds a shorthand method to create new content


composer require kreait/ezpublish-migrations-bundle

Enable the DoctrineMigrationsBundle and the KreaitEzPublishMigrationsBundle in AppKernel.php (eZ Platform) or EzPublishKernel.php (eZ Publish 5):

public function registerBundles()
    $bundles = array(
        new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
        new Kreait\EzPublish\MigrationsBundle\KreaitEzPublishMigrationsBundle(),


You can configure the bundles in your config.yml. The examples below are the default values.

    dir_name: "%kernel.root_dir%/DoctrineMigrations"
    namespace: Application\Migrations
    table_name: migration_versions
    name: Application Migrations

    # The login name of the user performing the migrations.
    ez_migrations_user: admin


The usage is identical to Symfony's DoctrineMigrationBundle, with the addition of the following command:

ezpublish:migrations:generate # Generate a blank eZ Publish/Platform enabled migration class

Changing the current migration user during a migration

You can change the current eZ Publish user inside a migration by issuing the following command:


and restore the default Migration user by using:


See src/Resources/doc/examples for more usage examples.

Known issues

When you create a migration using only eZ Publish's API methods, no SQL statements are executed in terms of the DoctrineMigrationsBundle. This results in the following message:

Migration was executed but did not result in any SQL statements.