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;
}