public function buildSPILocationCreateStruct(
        $locationCreateStruct,
        APILocation $parentLocation,
        $mainLocation,
        $contentId,
        $contentVersionNo
    ) {
        if (!$this->isValidLocationPriority($locationCreateStruct->priority)) {
            throw new InvalidArgumentValue('priority', $locationCreateStruct->priority, 'LocationCreateStruct');
        }

        if (!is_bool($locationCreateStruct->hidden)) {
            throw new InvalidArgumentValue('hidden', $locationCreateStruct->hidden, 'LocationCreateStruct');
        }

        if ($locationCreateStruct->remoteId !== null && (!is_string($locationCreateStruct->remoteId) || empty($locationCreateStruct->remoteId))) {
            throw new InvalidArgumentValue('remoteId', $locationCreateStruct->remoteId, 'LocationCreateStruct');
        }

        if ($locationCreateStruct->sortField !== null && !$this->isValidLocationSortField($locationCreateStruct->sortField)) {
            throw new InvalidArgumentValue('sortField', $locationCreateStruct->sortField, 'LocationCreateStruct');
        }

        if ($locationCreateStruct->sortOrder !== null && !$this->isValidLocationSortOrder($locationCreateStruct->sortOrder)) {
            throw new InvalidArgumentValue('sortOrder', $locationCreateStruct->sortOrder, 'LocationCreateStruct');
        }

        $remoteId = $locationCreateStruct->remoteId;
        if (null === $remoteId) {
            $remoteId = $this->getUniqueHash($locationCreateStruct);
        } else {
            try {
                $this->locationHandler->loadByRemoteId($remoteId);
                throw new InvalidArgumentException(
                    '$locationCreateStructs',
                    "Another Location with remoteId '{$remoteId}' exists"
                );
            } catch (NotFoundException $e) {
                // Do nothing
            }
        }

        return new SPILocationCreateStruct(
            array(
                'priority' => $locationCreateStruct->priority,
                'hidden' => $locationCreateStruct->hidden,
                // If we declare the new Location as hidden, it is automatically invisible
                // Otherwise it picks up visibility from parent Location
                // Note: There is no need to check for hidden status of parent, as hidden Location
                // is always invisible as well
                'invisible' => ($locationCreateStruct->hidden === true || $parentLocation->invisible),
                'remoteId' => $remoteId,
                'contentId' => $contentId,
                'contentVersion' => $contentVersionNo,
                // pathIdentificationString will be set in storage
                'pathIdentificationString' => null,
                'mainLocationId' => $mainLocation,
                'sortField' => $locationCreateStruct->sortField !== null ? $locationCreateStruct->sortField : Location::SORT_FIELD_NAME,
                'sortOrder' => $locationCreateStruct->sortOrder !== null ? $locationCreateStruct->sortOrder : Location::SORT_ORDER_ASC,
                'parentId' => $locationCreateStruct->parentLocationId,
            )
        );
    }
public function buildSPILocationCreateStruct(
        $locationCreateStruct,
        APILocation $parentLocation,
        $mainLocation,
        $contentId,
        $contentVersionNo
    ) {
        if (!$this->isValidLocationPriority($locationCreateStruct->priority)) {
            throw new InvalidArgumentValue('priority', $locationCreateStruct->priority, 'LocationCreateStruct');
        }

        if (!is_bool($locationCreateStruct->hidden)) {
            throw new InvalidArgumentValue('hidden', $locationCreateStruct->hidden, 'LocationCreateStruct');
        }

        if ($locationCreateStruct->remoteId !== null && (!is_string($locationCreateStruct->remoteId) || empty($locationCreateStruct->remoteId))) {
            throw new InvalidArgumentValue('remoteId', $locationCreateStruct->remoteId, 'LocationCreateStruct');
        }

        if ($locationCreateStruct->sortField !== null && !$this->isValidLocationSortField($locationCreateStruct->sortField)) {
            throw new InvalidArgumentValue('sortField', $locationCreateStruct->sortField, 'LocationCreateStruct');
        }

        if ($locationCreateStruct->sortOrder !== null && !$this->isValidLocationSortOrder($locationCreateStruct->sortOrder)) {
            throw new InvalidArgumentValue('sortOrder', $locationCreateStruct->sortOrder, 'LocationCreateStruct');
        }

        $remoteId = $locationCreateStruct->remoteId;
        if (null === $remoteId) {
            $remoteId = $this->getUniqueHash($locationCreateStruct);
        } else {
            try {
                $this->locationHandler->loadByRemoteId($remoteId);
                throw new InvalidArgumentException(
                    '$locationCreateStructs',
                    "Another Location with remoteId '{$remoteId}' exists"
                );
            } catch (NotFoundException $e) {
                // Do nothing
            }
        }

        return new SPILocationCreateStruct(
            array(
                'priority' => $locationCreateStruct->priority,
                'hidden' => $locationCreateStruct->hidden,
                // If we declare the new Location as hidden, it is automatically invisible
                // Otherwise it picks up visibility from parent Location
                // Note: There is no need to check for hidden status of parent, as hidden Location
                // is always invisible as well
                'invisible' => ($locationCreateStruct->hidden === true || $parentLocation->invisible),
                'remoteId' => $remoteId,
                'contentId' => $contentId,
                'contentVersion' => $contentVersionNo,
                // pathIdentificationString will be set in storage
                'pathIdentificationString' => null,
                'mainLocationId' => $mainLocation,
                'sortField' => $locationCreateStruct->sortField !== null ? $locationCreateStruct->sortField : Location::SORT_FIELD_NAME,
                'sortOrder' => $locationCreateStruct->sortOrder !== null ? $locationCreateStruct->sortOrder : Location::SORT_ORDER_ASC,
                'parentId' => $locationCreateStruct->parentLocationId,
            )
        );
    }
public function buildSPILocationCreateStruct ( $ locationCreateStruct , APILocation $ parentLocation , $ mainLocation , $ contentId , $ contentVersionNo ) { if ( ! $ this -> isValidLocationPriority ( $ locationCreateStruct -> priority ) ) { throw new InvalidArgumentValue ( 'priority' , $ locationCreateStruct -> priority , 'LocationCreateStruct' ) ; } if ( ! is_bool ( $ locationCreateStruct -> hidden ) ) { throw new InvalidArgumentValue ( 'hidden' , $ locationCreateStruct -> hidden , 'LocationCreateStruct' ) ; } if ( $ locationCreateStruct -> remoteId !== null && ( ! is_string ( $ locationCreateStruct -> remoteId ) || empty ( $ locationCreateStruct -> remoteId ) ) ) { throw new InvalidArgumentValue ( 'remoteId' , $ locationCreateStruct -> remoteId , 'LocationCreateStruct' ) ; } if ( $ locationCreateStruct -> sortField !== null && ! $ this -> isValidLocationSortField ( $ locationCreateStruct -> sortField ) ) { throw new InvalidArgumentValue ( 'sortField' , $ locationCreateStruct -> sortField , 'LocationCreateStruct' ) ; } if ( $ locationCreateStruct -> sortOrder !== null && ! $ this -> isValidLocationSortOrder ( $ locationCreateStruct -> sortOrder ) ) { throw new InvalidArgumentValue ( 'sortOrder' , $ locationCreateStruct -> sortOrder , 'LocationCreateStruct' ) ; } $ remoteId = $ locationCreateStruct -> remoteId ; if ( null === $ remoteId ) { $ remoteId = $ this -> getUniqueHash ( $ locationCreateStruct ) ; } else { try { $ this -> locationHandler -> loadByRemoteId ( $ remoteId ) ; throw new InvalidArgumentException ( '$locationCreateStructs' , "Another Location with remoteId '{$remoteId}' exists" ) ; } catch ( NotFoundException $ e ) { // Do nothing } } return new SPILocationCreateStruct ( array ( 'priority' => $ locationCreateStruct -> priority , 'hidden' => $ locationCreateStruct -> hidden , // If we declare the new Location as hidden, it is automatically invisible // Otherwise it picks up visibility from parent Location // Note: There is no need to check for hidden status of parent, as hidden Location // is always invisible as well 'invisible' => ( $ locationCreateStruct -> hidden === true || $ parentLocation -> invisible ) , 'remoteId' => $ remoteId , 'contentId' => $ contentId , 'contentVersion' => $ contentVersionNo , // pathIdentificationString will be set in storage 'pathIdentificationString' => null , 'mainLocationId' => $ mainLocation , 'sortField' => $ locationCreateStruct -> sortField !== null ? $ locationCreateStruct -> sortField : Location :: SORT_FIELD_NAME , 'sortOrder' => $ locationCreateStruct -> sortOrder !== null ? $ locationCreateStruct -> sortOrder : Location :: SORT_ORDER_ASC , 'parentId' => $ locationCreateStruct -> parentLocationId , ) ) ; }
Creates an array of SPI location create structs from given array of API location create structs.

@throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException

@param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $locationCreateStruct
@param \eZ\Publish\API\Repository\Values\Content\Location $parentLocation
@param mixed $mainLocation
@param mixed $contentId
@param mixed $contentVersionNo

@return \eZ\Publish\SPI\Persistence\Content\Location\CreateStruct
Creates an array of SPI location create structs from given array of API location create structs .