plugin/exo/Serializer/Item/ItemSerializer.php
private function deserializeObjects(Item $question, array $objects = [], array $options = [])
    {
        $objectEntities = $question->getObjects()->toArray();
        $question->emptyObjects();

        foreach ($objects as $index => $objectData) {
            $existingObject = null;

            // Searches for an existing object entity.
            foreach ($objectEntities as $entityIndex => $entityObject) {
                /** @var ItemObject $entityObject */
                if ($entityObject->getUuid() === $objectData['id']) {
                    $existingObject = $entityObject;
                    unset($objectEntities[$entityIndex]);
                    break;
                }
            }
            $itemObject = $this->itemObjectSerializer->deserialize($objectData, $existingObject, $options);
            $itemObject->setOrder($index);
            $question->addObject($itemObject);
        }

        // Remaining objects are no longer in the Item
        if (0 < count($objectEntities)) {
            foreach ($objectEntities as $objectToRemove) {
                $this->om->remove($objectToRemove);
            }
        }
    }
private function deserializeObjects(Item $question, array $objects = [], array $options = [])
    {
        $objectEntities = $question->getObjects()->toArray();
        $question->emptyObjects();

        foreach ($objects as $index => $objectData) {
            $existingObject = null;

            // Searches for an existing object entity.
            foreach ($objectEntities as $entityIndex => $entityObject) {
                /** @var ItemObject $entityObject */
                if ($entityObject->getUuid() === $objectData['id']) {
                    $existingObject = $entityObject;
                    unset($objectEntities[$entityIndex]);
                    break;
                }
            }
            $itemObject = $this->itemObjectSerializer->deserialize($objectData, $existingObject, $options);
            $itemObject->setOrder($index);
            $question->addObject($itemObject);
        }

        // Remaining objects are no longer in the Item
        if (0 < count($objectEntities)) {
            foreach ($objectEntities as $objectToRemove) {
                $this->om->remove($objectToRemove);
            }
        }
    }
private function deserializeObjects ( Item $ question , array $ objects = [ ] , array $ options = [ ] ) { $ objectEntities = $ question -> getObjects ( ) -> toArray ( ) ; $ question -> emptyObjects ( ) ; foreach ( $ objects as $ index => $ objectData ) { $ existingObject = null ; // Searches for an existing object entity. foreach ( $ objectEntities as $ entityIndex => $ entityObject ) { /** @var ItemObject $entityObject */ if ( $ entityObject -> getUuid ( ) === $ objectData [ 'id' ] ) { $ existingObject = $ entityObject ; unset ( $ objectEntities [ $ entityIndex ] ) ; break ; } } $ itemObject = $ this -> itemObjectSerializer -> deserialize ( $ objectData , $ existingObject , $ options ) ; $ itemObject -> setOrder ( $ index ) ; $ question -> addObject ( $ itemObject ) ; } // Remaining objects are no longer in the Item if ( 0 < count ( $ objectEntities ) ) { foreach ( $ objectEntities as $ objectToRemove ) { $ this -> om -> remove ( $ objectToRemove ) ; } } }
Deserializes Item objects.

@param Item  $question
@param array $objects
@param array $options
Deserializes Item objects .