Forest header image

Symfony Finland
Random things on PHP, Symfony and web development

How to copy and move Subtrees with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the SubtreeCommand class. * * @copyright Copyright (C) eZ Systems AS. All rights re…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to list Sections with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the BrowseLocationsCommand class. * * @copyright Copyright (C) eZ Systems AS. All r…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to list Sections with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the BrowseLocationsCommand class. * * @copyright Copyright (C) eZ Systems AS. All r…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to hide a Location with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the HideLocationCommand class. * * @copyright Copyright (C) eZ Systems AS. All righ…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to delete a Subtree with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the DeleteSubtree class. * * @copyright Copyright (C) eZ Systems AS. All rights res…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to create an Image with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the CreateImageCommand class. * * @copyright Copyright (C) eZ Systems AS. All right…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to create a Content Type with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the CreateContentTypeCommand class. * * @copyright Copyright (C) eZ Systems AS. All…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to create Content with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the CreateContentCommand class. * * @copyright Copyright (C) eZ Systems AS. All rig…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to copy Content with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the CopyContentCommand class. * * @copyright Copyright (C) eZ Systems AS. All right…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to Browse Locations with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the BrowseLocationsCommand class. * * @copyright Copyright (C) eZ Systems AS. All r…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to assign Content to a Section with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the AssignContentToSectionCommand class. * * @copyright Copyright (C) eZ Systems AS…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to add Relations to Content with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the AddRelationCommand class. * * @copyright Copyright (C) eZ Systems AS. All right…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to add Locations to Content with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the AddLocationToContentCommand class. * * @copyright Copyright (C) eZ Systems AS. …


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

eZ Platform data migrations with Doctrine

eZ Platform (and eZ Publish 5.x) use the Doctrine DBAL for connecting to the database. Using this commonly used layer and frameworks allows developers to use the same tools as for their custom applications implementations. Learn more about Database Schema Migrations with Doctrine from this light…


Written by Jani Tarvainen on Tuesday March 15, 2016
Permalink -

Debug emails in Symfony / eZ Platform / Publish with a file spool

Debugging emails can be be a burden. Continuously sending and receiving emails to your account... waiting for them to receive and so on. eZ Publish 4.x had support for pushing out outgoing emails to files instead of smtp or sendmail. The Swiftmailer configuration in Symfony2 sites enable a simil…


Written by Jani Tarvainen on Thursday November 12, 2015
Permalink - Tags: email, swiftmail, debug


Check the existence of a field in a Content Object in eZ Publish in Twig

To check the existence of a specific field you can use Twig in eZ Platform: {% if content.fields.cool_field is defined %} This content has a cool_field field! {% else %} This content does NOT have a cool_field field! {% endif %} Kudos to Edi Modric for the tip, I was wasting t…


Written by Jani Tarvainen on Wednesday November 4, 2015
Permalink -

Display Symfony debug toolbar in production (eZ Platform)

One easy way of displaying the Symfony debug toolbar in production environments is to use an additional virtualhost and a modified hosts file: Copy your virtual host (www.example.com -> dev1828.example.com) Change dev1828.example.com to use the dev environment Add an entry to …


Written by Jani Tarvainen on Monday October 26, 2015
Permalink -

eZ Platform Multisite & Multiple Repository Configuration

eZ Platform can run with configurations that have multiple separate content repositories. For the most part creating new repositories and sites is self documenting. There is gotcha with setting persistence caching for multiple repositories. This leads to random fatal errors as stash persistence …


Written by Jani Tarvainen on Friday October 16, 2015
Permalink - Tags: ezplatform, caching, cache

eZ Publish 5 / Platform Migration Bundle

Migrations for eZ Publish 5, based on Doctrine Migrations, very similar to Symfony's DoctrineMigrationsBundle. Migrations for eZ Publish 5


Written by Jani Tarvainen on Thursday October 15, 2015
Permalink -