Convert array to BaseDto object

@param array $itemData
@return BaseDto
173495
protected function arrayToDto(array $itemData)
    {
        foreach ($itemData as $field => $value) {
            if (!isset($this->scheme[$field])) {
                throw new InvalidArgumentException("Undefined field '$field' in scheme");
            }

            $typeService = $this->scheme[$field]['type'];
            $itemData[$field] = $this->typePluginManager->get($typeService, ['value' => $value]);
        }

        return new $this->dtoClassName($itemData);
    }
1238948
public function process($itemName, $entityName)
    {
        $inputs = array(
            'itemName' => $itemName,
            'entityName' => $entityName,
        );
        $this->setMethods($inputs);

        $convertedDefs = $this->load($itemName, $entityName);

        $inputs = $this->setArrayValue(null, $inputs);
        $this->setMethods($inputs);

        return $convertedDefs;
    }
821863
public function update(array $entityData)
    {
        $this->preUpdate($entityData);
        $entity = $this->doUpdate($entityData);
        $this->postUpdate($entityData);
        $this->getEntityManager()->flush($entity);

        return $entity;
    }
1257511
public static function FromArray( array $objectData )
   {

      if ( \count( $objectData ) == 3 )
      {
         if ( false !== ( $hex = ColorTool::Color2Hex( $objectData ) ) )
         {
            return new Color( $hex );
         }
      }

      $rgb = array();

      if ( isset( $objectData[ 'r' ] ) )
      {
         $rgb[ 0 ] = \intval( $objectData[ 'r' ] );
      }
      else if ( isset( $objectData[ 'red' ] ) )
      {
         $rgb[ 0 ] = \intval( $objectData[ 'red' ] );
      }
      else if ( isset( $objectData[ 'Red' ] ) )
      {
         $rgb[ 0 ] = \intval( $objectData[ 'Red' ] );
      }
      else
      {
         return new Color();
      }

      if ( isset( $objectData[ 'g' ] ) )
      {
         $rgb[ 1 ] = \intval( $objectData[ 'g' ] );
      }
      else if ( isset( $objectData[ 'green' ] ) )
      {
         $rgb[ 1 ] = \intval( $objectData[ 'green' ] );
      }
      else if ( isset( $objectData[ 'Green' ] ) )
      {
         $rgb[ 1 ] = \intval( $objectData[ 'Green' ] );
      }
      else
      {
         return new Color();
      }

      if ( isset( $objectData[ 'b' ] ) )
      {
         $rgb[ 2 ] = \intval( $objectData[ 'b' ] );
      }
      else if ( isset( $objectData[ 'blue' ] ) )
      {
         $rgb[ 2 ] = \intval( $objectData[ 'blue' ] );
      }
      else if ( isset( $objectData[ 'Blue' ] ) )
      {
         $rgb[ 2 ] = \intval( $objectData[ 'Blue' ] );
      }
      else
      {
         return new Color();
      }

      if ( false !== ( $hex = ColorTool::Rgb2Hex( $rgb ) ) )
      {
         return new Color( $hex );
      }

      return new Color();

   }
279707
protected function saveCategoryAttributes(array $attributesData)
    {
        $entityFieldName = 'entity_id';
        if ($this->categoryImportVersionFeature) {
            $entityFieldName = $this->categoryImportVersionFeature->getEntityFieldName();
        }

        $entityIds = array();

        foreach ($attributesData as $tableName => $data) {
            $tableData = [];

            foreach ($data as $entityId => $attributes) {
                $entityIds[] = $entityId;

                foreach ($attributes as $attributeId => $storeValues) {
                    foreach ($storeValues as $storeId => $storeValue) {
                        $tableData[] = [
                            $entityFieldName => $entityId,
                            'attribute_id' => $attributeId,
                            'store_id' => $storeId,
                            'value' => $storeValue
                        ];
                    }
                }
            }

            $this->_connection->insertOnDuplicate($tableName, $tableData, ['value']);
        }

        $entityIds = array_unique($entityIds);
        foreach ($entityIds as $entityId) {
            $this->reindexUpdatedCategories($entityId);
        }


        return $this;
    }
1221743
@Nonnull
  public final ITEMTYPE createChildItem (@Nullable final DATATYPE aData)
  {
    // create new item
    final ITEMTYPE aItem = m_aFactory.create (thisAsT ());
    if (aItem == null)
      throw new IllegalStateException ("null item created!");
    aItem.setData (aData);
    internalAddChild (aItem);
    return aItem;
  }
1025124
public static function fromData(array $data)
    {
        $group = new static(array_map(function ($data) {
            return $data['class']::fromData($data['params']);
        }, $data['constraints']));

        return $group->logicalOperator($data['logicalOperator']);
    }
454097
public function create($itemData, $rewriteIfExist = false)
    {
        $newData = $this->preCreate($itemData, $rewriteIfExist);
        $result = $this->dataStore->create($newData, $rewriteIfExist);

        return $this->postCreate($result, $newData, $rewriteIfExist);
    }
203718
private function addTermData($termData)
    {
        $labelsByThesaurusId = [];

        foreach ($termData as $currentTerm) {
            $label = $currentTerm['expansions_terms'];

            if (isset($currentTerm['expanded_term']) && $currentTerm['expanded_term']) {
                $label = sprintf("%s => %s", $currentTerm['expanded_term'], $label);
            }

            $labelsByThesaurusId[$currentTerm['thesaurus_id']][] = $label;
        }

        foreach ($labelsByThesaurusId as $thesaurusId => $labels) {
            $this->_items[$thesaurusId]->setData('terms_summary', implode(" <br/> ", $labels));
        }

        return $this;
    }
1038732
protected function encodeData($serializedData)
    {
        $result = json_encode($serializedData);
        if ($result === false) {
            $errorCode = json_last_error();
            throw new JsonException("Failed serialize json.", $errorCode);
        }

        return $result;
    }
559395
public static function create(array $callbackData): self
    {
        $ref = $callbackData['ref'] ?? null;
        $source = $callbackData['source'] ?? null;
        $type = $callbackData['type'] ?? null;

        return new self($ref, $source, $type);
    }
766199
private function createDataItems(array $data)
    {
        $items = [];
        foreach ($data as $item) {
            $items[$item['label']] = new UserDataItem(
                $item['label'],
                $item['value'],
                $item['isValid'],
                $item['isOwner']
            );
        }

        return $items;
    }
741210
public function transformDataFromRepository($modelData)
    {
        foreach ($this->columnTransforms as $columnName => $transforms) {
            if ($transforms[0] !== null) {
                $closure = $transforms[0];

                $modelData[$columnName] = $closure($modelData);
            }
        }

        return $modelData;
    }
484344
public function unserialize($serializedData)
    {
        $repositoryData = json_decode($serializedData, true);
        $references     = $repositoryData['references'];

        foreach ($references as $name => $proxyReference) {
            $this->setReference(
                $name,
                $this->getManager()->getReference(
                    $proxyReference[0], // entity class name
                    $proxyReference[1]  // identifiers
                )
            );
        }

        $identities = $repositoryData['identities'];

        foreach ($identities as $name => $identity) {
            $this->setReferenceIdentity($name, $identity);
        }
    }
1298344
public function deserializeQuestion(array $itemData, AbstractItem $item = null, array $options = [])
    {
        return $this->getItemSerializer()->deserialize($itemData, $item, $options);
    }
1291086
public function fileUpload(array $fileData)
    {
        if (!isset($fileData['name'])) {
            throw new \InvalidArgumentException(
                'File data is invalid'
            );
        }

        $target = $this->uploadTarget($fileData['name']);

        $ret = move_uploaded_file($fileData['tmp_name'], $target);

        if ($ret === false) {
            $this->logger->warning(sprintf('Could not upload file %s', $target));

            return '';
        } else {
            $this->logger->notice(sprintf('File %s uploaded succesfully', $target));
            $basePath = $this->basePath();
            $target   = str_replace($basePath, '', $target);

            return $target;
        }
    }
337199
public static function build($basicData)
    {
        $className = $basicData[TaskInterface::JSON_TASK_CLASS_NAME_KEY];

        if (class_exists($className) && is_subclass_of($className, TaskInterface::class)) {
            $metaData = $basicData[TaskInterface::JSON_METADATA_KEY];

            /** @var TaskInterface $task */
            $task = new $className($metaData[TaskInterface::JSON_METADATA_ID_KEY], $metaData[TaskInterface::JSON_METADATA_OWNER_KEY]);
            $task->setMetadata($metaData);
            $task->setParameter($basicData[TaskInterface::JSON_PARAMETERS_KEY]);

            if (isset($metaData[TaskInterface::JSON_METADATA_CREATED_AT_KEY])) {
                $task->setCreatedAt(new \DateTime($metaData[TaskInterface::JSON_METADATA_CREATED_AT_KEY]));
            }

            return $task;
        }

        throw new InvalidTaskException;
    }