BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

Update object only for specified conditions #46

Open betterapp opened 2 years ago

betterapp commented 2 years ago

Is it possible to update data only when specified conditions occur ? For example. Imagine we have a product with some workflow status or type. For example if workflow status is "new product" or type is 'computer' DD will allow update data. but if workflow status is other then "new product" or type is other then 'computer' it will not allow to update anything via DataPort.

I think about something like under initialization function add code that:

  1. Load current object by some key value.
  2. Check product type or workflow status.
  3. If condition not pass return false.
BlackbitDevs commented 2 years ago

The initialization function would not work here because returning false there aborts the complete import, not only the current item.

But you can do something similar in one of your key fields: As the import gets skipped when a key field returns null, you could load the object in one of the key fields, do your check and if the check is not valid, return null.