Object Synchronization Flow - Sintraconsulting/pimcore-product-sync-plugin GitHub Wiki

Object Synchronization Flow

Objects synchronization require the usage of the ServerObjectInfo FieldCollection provided by the SintraPimcoreBundle. In the skeleton of the "Product" class provided by the SintraPimcoreBundle this FieldCollection is already attached in the class definition.

If you need to synchronize objects of other classes, you just need to:

  1. Open the class definition of the class that you want to synchronize
  2. Attach the ServerObjectInfo FieldCollection somewhere in the class definition


The ServerObjectInfo FieldCollection has the following structure:

  • Name (readonly): The name of the server

  • server (readonly): The reference the TargetServer object

  • Object ID (readonly): The corresponding object ID on the server after synchronization

  • Variant ID (readonly): If the object is a variant, the variant ID on the server after synchronization

  • Export Object: if checked, the object will be considered in the synchronization flow

  • Can Be Exported (readonly): if checked, it means that all required fields for the server are not empty,

  • Synchronized (readonly): if not checked, it means that the object must be synchronized

  • Synchronized At (readonly): The last synchronization date


Every time that an object is saved on Pimcore:

  • An instance of the ServerObjectInfo FieldCollection is automatically attached to the object for each TargetServer that you have configured if not already present in the object.

  • All the "Fields to Export" declared in the TargetServer are checked: if at least one of them has a different value compared to the previous one, "Synchronized" flag is set to false

  • All the required fields in the "Export Map" are checked: if all required fields are not empty the "Can Be Exported" flag is set to true


For Products, the synchronization flow can be launched with the syncProduct.php script (you can easily duplicate to create a custom script for each needed class). Each time that the script is launched, a batch of Products will be synchronized to each enabled server attached to them. A product is valid for the synchronization if:

  • Is "published" on Pimcore
  • The "Export Object" flag is checked
  • The "Can Be Exported" flag is checked
  • The "Synchronized" flag is not checked
⚠️ **GitHub.com Fallback** ⚠️