Forest header image

Symfony Finland
Random things on PHP, Symfony and web development

Introducing the Kaliop Migrations Bundle for eZ Platform and eZ Publish

In systems with very dynamic data models, such as Content Management Systems, transferring data models and changes to them between environments can be very challenging. eZ Platform and the previous generation eZ Publish CMS products are such systems.

Many developers continue to resort to manually replicating the changes via the admin UI in production or vice versa. Alternatively holding production as the master copy and taking regular exports to development is also a strategy that works. However this can time consuming and impractical if your database is very large and your production environment is complex.

Since eZ Systems announced their transition to the Symfony Framework in 2012, many eZ Publish and eZ Platform developers have become well versed in Symfony development. And as such they have used, or at least heard of, the Doctrine Migrations Bundle:

The database migrations feature is an extension of the database abstraction layer and offers you the ability to programmatically deploy new versions of your database schema in a safe, easy and standardized way.

Doctrine Migrations is not directly usable with eZ Platform as it does not employ the Doctrine ORM for persisting data in the database. eZ does use Doctrine, but only as a Database Abstraction Layer.

Kaliop eZ Migration Bundle - migrations with YAML

Kaliop is a company that works with many Open Source CMSes, including Drupal and eZ Publish. They are active in many open source communities, being a responsible community member and have contibuted the eZ Migration Bundle to the eZ Community using eZ Platform and eZ Publish 5.x products.

This bundle is inspired by the Doctrine Migrations Bundle, but is not a direct replication of it. Instead of using code to build up data structures, it's an abstraction that uses YAML as a migration DSL. I've used it before when testing converting configurations from Drupal 8 to eZ Platform.

After installling the bundle, your Symfony console will receive three new commands:

  • Generate: This will generate a blank example migrations file to a specified bundle
  • Status: This will list the status of migrations that are available within the current installation
  • Update: This will execute the migrations that were listed by the status command

All of these are rather straightforward, but it's worth noting that each of these commands relies on files YAML files stored in Symfony bundles in the eZ project implementation. This translates to a simple workflow when working with Git and feature branch workflow.

The additions and changes you need applied to your content repository are equals with with your application and template in terms of version control. In addition to simply creating and modifying content types, the Bundle supports a wide range of functions:

  • Manage content objects
  • Manage content object locations
  • Manage content types
  • Manage users and user groups
  • Manage roles and policies

The above set enables a straightforward way of managing the key features of the eZ Platform content repository features, and can be extended with support for Object States and more in the future.

Learn more about eZ Platform and migrations:

Written by Jani Tarvainen on Sunday May 29, 2016
Permalink - Tags: ezplatform, symfony, doctrine

« Choose a project vendor that creates Open Source, not one that just uses it - Import the Facebook GraphQL example data model to eZ Platform »