public function createGlobalUrlAlias($resource, $path, $languageCode, $forwarding = false, $alwaysAvailable = false)
{
if (!preg_match('#^([a-zA-Z0-9_]+):(.+)$#', $resource, $matches)) {
throw new InvalidArgumentException('$resource', 'argument is not valid');
}
$path = $this->cleanUrl($path);
if ($matches[1] === 'eznode' || 0 === strpos($resource, 'module:content/view/full/')) {
if ($matches[1] === 'eznode') {
$locationId = $matches[2];
} else {
$resourcePath = explode('/', $matches[2]);
$locationId = end($resourcePath);
}
return $this->createUrlAlias($this->repository->getLocationService()->loadLocation($locationId), $path, $languageCode, $forwarding, $alwaysAvailable);
}
$this->repository->beginTransaction();
try {
$spiUrlAlias = $this->urlAliasHandler->createGlobalUrlAlias($matches[1] . ':' . $this->cleanUrl($matches[2]), $path, $forwarding, $languageCode, $alwaysAvailable);
$this->repository->commit();
} catch (ForbiddenException $e) {
$this->repository->rollback();
throw new InvalidArgumentException('$path', $e->getMessage(), $e);
} catch (Exception $e) {
$this->repository->rollback();
throw $e;
}
return $this->buildUrlAliasDomainObject($spiUrlAlias, $path);
}