How to overwrite dataSet values?


#1

According to

It seems like you can modify the data by adding a step.According to

you can override the array key by providing it with a new value. However, this is not possible with a step looking like this:
public function execute(DataSetInterface $dataSet)
{
foreach($dataSet[‘localizedAttributes’] as $idLocale => $data){
if(!empty($dataSet[‘attributes’][‘name’]) && empty($dataSet[‘localizedAttributes’][$idLocale][‘name’])){
$dataSet[‘localizedAttributes’][$idLocale][‘name’] = $dataSet[‘attributes’][‘name’];
}
}
}

As it yields Indirect modification of overloaded element of Spryker\\Zed\\DataImport\\Business\\Model\\DataSet\\DataSet has no effect

How should we adjust the dataset in such case?


#2

Hi @janmyszkier,

sorry for the late reply. Somehow this topic left unanswered.

So basically you need to build a temp array and just change the dataSet with the newly created array.
Hope this can help you.

Best regards,
Spryker Support Team