eZ\Publish\Core\Repository\ContentService::buildSPILocationCreateStructs PHP Method

buildSPILocationCreateStructs() protected method

protected buildSPILocationCreateStructs ( array $locationCreateStructs ) : eZ\Publish\SPI\Persistence\Content\Location\CreateStruct[]
$locationCreateStructs array
return eZ\Publish\SPI\Persistence\Content\Location\CreateStruct[]
    protected function buildSPILocationCreateStructs(array $locationCreateStructs)
    {
        $spiLocationCreateStructs = array();
        $parentLocationIdSet = array();
        $mainLocation = true;
        foreach ($locationCreateStructs as $locationCreateStruct) {
            if (isset($parentLocationIdSet[$locationCreateStruct->parentLocationId])) {
                throw new InvalidArgumentException('$locationCreateStructs', "Multiple LocationCreateStructs with the same parent Location '{$locationCreateStruct->parentLocationId}' are given");
            }
            $parentLocationIdSet[$locationCreateStruct->parentLocationId] = true;
            $parentLocation = $this->repository->getLocationService()->loadLocation($locationCreateStruct->parentLocationId);
            $spiLocationCreateStructs[] = $this->domainMapper->buildSPILocationCreateStruct($locationCreateStruct, $parentLocation, $mainLocation, null, null);
            // First Location in the list will be created as main Location
            $mainLocation = false;
        }
        return $spiLocationCreateStructs;
    }