/**
  * Creates a new URL alias
  *
  * @throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException
  * @return \eZ\Publish\Core\REST\Server\Values\CreatedURLAlias
  */
 public function createURLAlias()
 {
     $urlAliasCreate = $this->inputDispatcher->parse(new Message(array('Content-Type' => $this->request->headers->get('Content-Type')), $this->request->getContent()));
     if ($urlAliasCreate['_type'] === 'LOCATION') {
         $locationPathParts = explode('/', $this->requestParser->parseHref($urlAliasCreate['location']['_href'], 'locationPath'));
         $location = $this->locationService->loadLocation(array_pop($locationPathParts));
         try {
             $createdURLAlias = $this->urlAliasService->createUrlAlias($location, $urlAliasCreate['path'], $urlAliasCreate['languageCode'], $urlAliasCreate['forward'], $urlAliasCreate['alwaysAvailable']);
         } catch (InvalidArgumentException $e) {
             throw new ForbiddenException($e->getMessage());
         }
     } else {
         try {
             $createdURLAlias = $this->urlAliasService->createGlobalUrlAlias($urlAliasCreate['resource'], $urlAliasCreate['path'], $urlAliasCreate['languageCode'], $urlAliasCreate['forward'], $urlAliasCreate['alwaysAvailable']);
         } catch (InvalidArgumentException $e) {
             throw new ForbiddenException($e->getMessage());
         }
     }
     return new Values\CreatedURLAlias(array('urlAlias' => $createdURLAlias));
 }
 /**
  * Create a user chosen $alias pointing to a resource in $languageCode.
  *
  * This method does not handle location resources - if a user enters a location target
  * the createCustomUrlAlias method has to be used.
  * This method runs URL filters and and transformers before storing them.
  * Hence the path returned in the URLAlias Value may differ from the given.
  *
  * $alwaysAvailable makes the alias available in all languages.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the path already exists for the given
  *         language or if resource is not valid
  *
  * @param string $resource
  * @param string $path
  * @param string $languageCode
  * @param boolean $forwarding
  * @param boolean $alwaysAvailable
  *
  * @return \eZ\Publish\API\Repository\Values\Content\URLAlias
  */
 public function createGlobalUrlAlias($resource, $path, $languageCode, $forwarding = false, $alwaysAvailable = false)
 {
     $returnValue = $this->service->createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable);
     $this->signalDispatcher->emit(new CreateGlobalUrlAliasSignal(array('urlAliasId' => $returnValue->id)));
     return $returnValue;
 }