1

The code snippet is as below:

$test = new PartnerRestrictionTransfer();
foreach($data as $data2)
{
  
  $data =  $test->setProductSku($data2);
}
print_r($data);die;
B-shan
  • 404
  • 1
  • 5
  • 14

1 Answers1

0

You require to create new object every-time you get new value for $data2 variable. Also for readability you can use different name for your object variable.

Below is the updated code:

foreach($data as $data2)
{
  $test = new PartnerRestrictionTransfer();
  $var[data1] =  $test->setProductSku($data2);
}
print_r($var);die;
B-shan
  • 404
  • 1
  • 5
  • 14