Techtalk: Pimcore Data Director: Optimize Inheritance + Deploy dataports

Updating the uppermost object

 

Enabling the 'Optimize inheritance' checkbox in the dataport settings leads the importer to set the imported data not necessarily directly on the object which is identified by the key fields but at one of its parents / ancestors in order to take advantage of object inheritance.

An example: You have the following master-slave product structure:

  • Master
    • Slave 1
    • Slave 2

There are 3 lines in your data source:

| ID | Name | Price | Master ID | Category ID | 

|----|--------------|-------|-----------|-------------|

| 1 | Test Product | | | 2 |

| 2 | Test Product | 10 | 1 | 2 |

| 3 | Test Product | 20 | 1 | 2 |

 

When you import with 'Optimize inheritance' the importer would update the master by setting the name and category. Then it imports the slaves also with Name and Category. When you later want to change the name or category, you have to change that in all 3 objects.

When you use 'Optimize inheritance' the importer would update the master as above. But when it comes to importing the slaves, the importer fetches the slave's siblings. If all siblings have the same value in the imported field, the value is only updated at the uppermost object. In this case, the name and category fields would stay empty for the slaves because all slaves have the same name and category. The category and name will only be updated at the master. Nevertheless, the slaves get the values in these fields via inheritance.

As prices differ between the slaves, they are set on the slave objects.

When you later want to change the name or category, you only have to change it on one single point: the master. This makes editing a lot easier. This also applies to a lot of other use-cases, e.g. technical data via object bricks: If you structure your object tree hierarchically, it often means that similar objects are under the same branch. For example, all products under a certain branch consist of the same material. Then the inheritance optimization would update the object brick field 'material' only for the branch root. All objects below would inherit this value.