This topic contains 3 replies, has 2 voices, and was last updated by Dima Makaruk 8 years, 9 months ago.
- Topic
My CSV look like this:
column1,column2,column3:item:id
text,text,1In this case the collection (column3) is normally denormalized containing one item in collection.
How is it possible to import more than one item in collection ?Something like this :
column1,column2,column3:item:id
text,text,1|3|4Normalizer method looks like this:
public function denormalize($data, $class, $format = null, array $context = array())
{
if (!is_array($data)) {
return new ArrayCollection();
}
$itemType = $this->getItemType($class);
if (!$itemType) {
return new ArrayCollection($data);
}
$result = new ArrayCollection();
foreach ($data as $item) {
$result->add($this->serializer->denormalize($item, $itemType, $format, $context));
}
return $result;
}Where :
$data = [‘item’ => [‘id’ => ‘1|3|4’]]
$item = [‘id’ => ‘1|3|4’]What actually should look like this
$data = [[‘id’ => ‘1’],[‘id’ => ‘3’],[‘id’ => ‘4’]]
Should i use a custom DataConverter before deserialization ?
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.