OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions ImportExportBundle how to make CollectionNormalizer working properly

This topic contains 3 replies, has 2 voices, and was last updated by  Dima Makaruk 5 years, 2 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #33894

    Dima Makaruk

    My CSV look like this:


    In 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 :


    Normalizer 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 ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #33895

    Dima Makaruk

    The DefaultDataConverter doesn’t check if the value should be an array:

    It look only if the key must be an array for further support of relations when deserializing.



    Dima Makaruk

    Hi thank you for the tip.
    Somehow i’ve missed the TreeDataConverter class,will try to use it.

    I created additional normalizer for this case it worked.

Viewing 3 replies - 1 through 3 (of 3 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

You will be redirected to [title]. Would you like to continue?

Yes No