Partial Content

Code

Working with eZ Publish 5 - Introduction

In early February, I had the opportunity to spend some learning some of the ins and outs of working with eZ Publish version 5 at a training event from eZ Systems. Having developed for years in eZ Publish, I knew 5 was going to be a big change, but didn't really consider how much change would be involved. After digging in, I found that there's a lot to like about the new system. The goal of this series of blog posts will be to help current eZ Publish developers get up to speed. We're mostly focusing on developers already familiar with eZ Publish 4, but as long as you have a basic familiarity with the CMS, you should be able to follow along.

The idea here is to provide a tutorial that will allow you to get up and running quickly with eZ Publish 5, even if you're a bit of a neophyte with Symfony (like me). We'll cover some basic concepts, and build out a basic site using only eZ Publish 5 concepts wherever possible. Each step of the tutorial has been stored as a branch in github to make it easy to follow along.

A lot of folks contributed in some way to the creation of this tutorial. Quick thanks to the staff at Blend Interactive and eZ Systems for their help clarifying and testing, and to Damien Pobel, who open-sourced the planet-ezpublish.fr site, around which much of my own code is based. That codebase proved a good introduction to eZ Publish 5 for me, and this tutorial will show that pedigree.

Some Things To Clear Up

First things first: Before we get in to code, let's address some facts and set aside any preconceived notions about what we're getting into: 

eZ Publish 5 is a Totally New CMS

If you've read anything about eZ Publish 5, you probably know that most of eZ's core components are being replaced by the Symfony framework.

The version number hints that this new release, like the past major releases, is a continuation of the same system many of us have used for years. And while that system is still around, the '5' parts of eZ 5 (the Symfony parts) are all new. In essence, eZ Publish 5 is a ground-up rewrite of the entire CMS. The overall design direction is that where a component of the Symfony stack can be used instead of the counterpart from eZ Publish 4, the eZ Publish 4 component has been replaced. Some examples:

  • All interaction is handled via Symfony Controllers
  • eZ templates are replaced by Twig templates
  • ini files replaced by yml files
  • eZjscore replaced by Assetic
  • eZ Publish caching is replaced by Symfony's caching

The core of the product, the eZ kernel itself, is now accessed via a Public API, which will remain stable in future versions. For developers, this is great news, since it means you're no longer hooking into core classes at random and hoping they don't change from version to version. 

In general, all of the architectural decisions that version 5 represents are great news. The Symfony community has a great ecosystem and a lot of mature, elegant code. By becoming a part of it, eZ developers spend less time working on the underlying platform components, and more time delivering the best CMS possible. From a business perspective, you're more likely to find developers with transferrable skills on Symfony, so it's a long-term win on that side as well.

eZ Publish 5 isn't a New CMS

Wait, what? Well, not yet anyway. While all of the pieces are here to build a site in eZ Publish 5, the administrative interface and a lot of the other system components (commenting, front-end editing, etc) have not yet been rewritten on the new stack. So for now, you'll be using a lot of the eZ Publish 4 code in your normal workflow. In fact, all of the previous eZ Publish code (now rechristened as eZ Publish Legacy) ships as part of eZ Publish 5, right alongside the shiny new Symfony-based kernel. This means that the CMS doesn't lose any features as it moves over to the new architecture, but it also means that there are some areas where you need to understand both systems or in some cases, duplicate effort.

You don't have to switch right now

The important thing to remember is that you dont have to start using the new architecture right now, or even this year. The development roadmap calls for the legacy architecture to be available for a long time, and there are a lot of clever methods built in to the Symfony architecture to allow it to fall back to using legacy components somewhat transparently. So you can choose to use as much or as little of the new architecture as you like. 

The Project

The point of this series, though, is to work with the shiny new stuff, so we're going to try to use as much of eZ Publish 5's Symfony components as we can. And to do that, I've selected a fairly basic project - this blog! Over the next few pages, we'll work on building out the templates for the blog, learning the components of eZ 5 as we go. 

What you need to follow along

I've placed all the code for this site out on github. I've made a branch for each step of the tutorial. and I'll note as we go along which branch you can pull down in order to catch up with the tutorial progress. The 'master' branch will be the code that this blog is actually running, which may be enhanced with extra features as time goes on. If you see a problem in either, please feel free to send a pull request, and I'll update the tutorial accordingly. There are still some things I'm learning myself, so I've called out some questions along the way. If you have the answer, drop me a note or a comment!

You'll also need a good working environment. Make sure you have all of the requirements for Symfony and eZ Publish installed.

Let's start by covering some of the basics of Symfony.