BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

NULL raw data fields overwriting #129

Open CRISTA-AF opened 10 months ago

CRISTA-AF commented 10 months ago

I want to automate imports to create and update objects. I've defied my dataport with the field names of the source and I have mapped them to my class. The problem is that the information that will be automatically imported is not always consistent so a colum might be emty. Upon these empty values I have noticed that any previous information mapped to the objects field gets deleted. The "Do not overwrite if already filled" option wont work because I need to be able to change information if it has changed (eg. prices of products) What am I missing? Is there a way to work around this?

BlackbitDevs commented 10 months ago

If I have understood everything correctly, you need the following callback function:

if($params['value') {
  // use value from import resource if it is filled
  return $params['value'];
}

// if import resource is empty, keep current value
return $params['currentValue'];