@param array $entityData

@return mixed
496635
protected function doUpdate(array $entityData)
    {
        $user = $this->find($entityData['id']);

        return $this->populate($user, $entityData);
    }
784761
public static function getFirstEntityValue($entityName, array $entities)
    {
        if (!isset($entities[$entityName][0]['value'])) {
            return null;
        }

        $val = $entities[$entityName][0]['value'];

        return is_array($val) && isset($val['value']) ? $val['value'] : $val;
    }
1353483
public function registerData(array $entityData)
    {
        foreach ($entityData as $data) {
            $this->registerEntity($this->normalizer->denormalize(
                $data,
                $this->entityCollection->getEntityClass()
            ));
        }
    }
1021854
protected function getRequestModel($requestData)
    {
        $requestModel = new RequestModel();
        $requestModel->attributes = $requestData;

        if (!$requestModel->validate()) {
            throw new ValidationException('Invalid JSON-RPC request parameters.', 0, $requestModel->getErrors());
        }

        return $requestModel;
    }
1280579
public function byData($data)
    {
        \UArray::doConvertToArray($data);
        $model = new $this;
        $model->id = $this->entity->extractId($data);
        foreach ($data as $name => $seed) {
            $attribute = $model->getAttribute($name);
            if (is_object($attribute)) {
                $attribute->setSeed($seed);
            } else {
                $model->set($name, $seed);
            }
        }
        $model->initialize();
        return $model;
    }
1316999
protected function extractRelationships(array $data, EntityMetadata $metadata)
    {
        $flattened = [];
        if (!isset($data['relationships']) || !is_array($data['relationships'])) {
            return $flattened;
        }

        foreach ($metadata->getRelationships() as $key => $relMeta) {
            if (!isset($data['relationships'][$key])) {
                continue;
            }
            $rel = $data['relationships'][$key];
            // Need to use array_key_exists over isset because 'null' is valid. Creating a key map for each relationship is too costly since every relationship needs the data check.
            if (false === array_key_exists('data', $rel)) {
                throw NormalizerException::badRequest(sprintf('The "data" member was missing from the payload for relationship "%s"', $key));
            }

            if (empty($rel['data'])) {
                $flattened[$key] = $relMeta->isOne() ? null : [];
                continue;
            }

            if (!is_array($rel['data'])) {
                throw NormalizerException::badRequest(sprintf('The "data" member is not valid in the payload for relationship "%s"', $key));
            }

            if (true === $relMeta->isOne() && true === $this->isSequentialArray($rel['data'])) {
                throw NormalizerException::badRequest(sprintf('The data payload for relationship "%s" is malformed. Data types of "one" must be an associative array, sequential found.', $key));
            }
            if (true === $relMeta->isMany() && false === $this->isSequentialArray($rel['data'])) {
                throw NormalizerException::badRequest(sprintf('The data payload for relationship "%s" is malformed. Data types of "many" must be a sequential array, associative found.', $key));
            }
            $flattened[$key] = $rel['data'];
        }
        return $flattened;
    }
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;
    }
1014028
protected function createAndReturnNewFirstEntity($data, $entityName)
    {
        if (is_array($data)) {
            $entity = $this->getFirstEntityByName($entityName);
            return $this->mapAttributesFromSecondEntityToFirstEntityAndReturnEntity($data, $entity);
        }

        return null;
    }
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);
    }
1306624
protected function normalizePathData(array $pathData)
    {
        $normalizedPathData = array();
        foreach ($pathData as $level => $rows) {
            $pathElementData = array();
            foreach ($rows as $row) {
                $this->normalizePathDataRow($pathElementData, $row);
            }

            $normalizedPathData[$level] = $pathElementData;
        }

        return $normalizedPathData;
    }
1249834
public function getCustomerAddressAttributesByEntityId($entityId)
    {

        // initialize the array for the attributes
        $attributes = array();

        // load the datetime attributes
        foreach ($this->customerAddressDatetimeRepository->findAllByEntityId($entityId) as $attribute) {
            $attributes[$attribute[MemberNames::ATTRIBUTE_ID]] = $attribute;
        }

        // load the decimal attributes
        foreach ($this->customerAddressDecimalRepository->findAllByEntityId($entityId) as $attribute) {
            $attributes[$attribute[MemberNames::ATTRIBUTE_ID]] = $attribute;
        }

        // load the integer attributes
        foreach ($this->customerAddressIntRepository->findAllByEntityId($entityId) as $attribute) {
            $attributes[$attribute[MemberNames::ATTRIBUTE_ID]] = $attribute;
        }

        // load the text attributes
        foreach ($this->customerAddressTextRepository->findAllByEntityId($entityId) as $attribute) {
            $attributes[$attribute[MemberNames::ATTRIBUTE_ID]] = $attribute;
        }

        // load the varchar attributes
        foreach ($this->customerAddressVarcharRepository->findAllByEntityId($entityId) as $attribute) {
            $attributes[$attribute[MemberNames::ATTRIBUTE_ID]] = $attribute;
        }

        // return the array with the attributes
        return $attributes;
    }
1120314
protected function getLink($linkData): string
    {
        $link = '';
        if (\is_array($linkData)) {
            $link = $linkData['link'] ?? '';
        } elseif (\is_string($linkData)) {
            $link = $linkData;
        }
        return $link;
    }
815867
protected function getEntity($entityId)
    {
        $entity = $this->getRepository()->get($entityId);
        if (!$entity instanceof EntityInterface) {
            throw new EntityNotFoundException(
                "There are no entities with provided entity ID."
            );
        }
        return $entity;
    }
834038
public function find($entityId)
    {
        $this->preFind($entityId);
        $entity = $this->doFind($entityId);
        $this->postFind($entity);

        return $entity;
    }
485110
public function get($entityId)
    {
        $key = $this->getEntityDescriptor()->className();
        $key .= '::'.$entityId;
        $entity = $this->getIdentityMap()->get($key, false);
        if ($entity === false) {
            $entity = $this->load($entityId);
        }
        return $entity;
    }
1338844
private function prepareValues($arrayData)
    {
        $arrayData = array_values($arrayData);

        $preparedValues = [];
        $vNumber = 1;
        foreach ($arrayData as $value) {
            $preparedValues[":value{$vNumber}"] = "$value";
            $vNumber++;
        }

        unset($arrayData);
        unset($vNumber);

        return $preparedValues;
    }
1199332
protected function convertArrayToObject($objectData)
    {
        $objectName = $this->getCollectedObjectName();

        if (is_array($objectData)) {
            $object = new $objectName();
            $object->fromArray($objectData);
            $objectData = $object;
        }

        if (!($objectData instanceof $objectName)) {
            throw new InvalidArgumentException(sprintf('%s collection can handle %s objects only', $objectName, $objectName));
        }

        return $objectData;
    }