New feature in eZ Dataflow 2.2

on Thursday 12 November 2020

Dataflow is a free project implemented by Code Rhapsodie whose goal is to easily manage input and output data flows in your Symfony project.

Its integration with the eZ Platform CMS replaces the old SQLi Import extension used on eZ Publish.

eZ Dataflow version 2.2 was recently released and provides a ready-to-use filter for most cases.

This filter will avoid saving eZ content that has not been changed since the last run of the feed.

Here is the list of fields (attributes) natively managed by the filter:

  • ezstring
  • ezauthor
  • ezboolean
  • ezcountry
  • ezdate
  • ezdatetime
  • ezemail
  • ezfloat
  • ezisbn
  • ezobjectrelation
  • ezobjectrelationlist
  • ezkeyword
  • ezselection
  • eztext
  • eztime
  • eztags
  • novaseometas
  • ezurl
  • ezmatrix
  • ezgmaplocation
  • ezrichtext

If the content type of the stream contains only fields of this type, then the filter can be used natively. Otherwise, you will need to add a field comparison service.

Note: Using the filter with a content type with unmanaged fields is counterproductive. The processing time will increase because the contents will be compared while a type of unmanaged field is considered different and will cause the content to be systematically updated.

   
<pre><?php

use CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\AbstractFieldComparator;
use eZ\Publish\Core\FieldType\Value;
//[...]

class MyFieldComparator extends AbstractFieldComparator
{
    //[...]
    protected function compareValues(Value $currentValue, Value $newValue): bool
    {
        // Return true if values are identical, false if values are different.
    }
}</pre>
   

Then register it as a Symfony service with the coderhapsodie.ezdataflow.field_comparator  tag and the type of fields processed by your comparator.

   
<pre># Service declaration
    App\FieldComparator\MyFieldComparator:
        parent: 'CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\AbstractFieldComparator'
        tags:
            - { name: 'coderhapsodie.ezdataflow.field_comparator', fieldType: 'my_field_type_identifier' }</pre>
   

Your service is ready, you can use the filter in your stream.

A vous de jouer !

A question? Need help?  Contact us! We are at your disposal to support you in all stages of your project.