public function createURLAlias(Request $request)
    {
        $urlAliasCreate = $this->inputDispatcher->parse(
            new Message(
                array('Content-Type' => $request->headers->get('Content-Type')),
                $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,
            )
        );
    }
public function createURLAlias(Request $request)
    {
        $urlAliasCreate = $this->inputDispatcher->parse(
            new Message(
                array('Content-Type' => $request->headers->get('Content-Type')),
                $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,
            )
        );
    }
public function createURLAlias ( Request $ request ) { $ urlAliasCreate = $ this -> inputDispatcher -> parse ( new Message ( array ( 'Content-Type' => $ request -> headers -> get ( 'Content-Type' ) ) , $ 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 , ) ) ; }
Creates a new URL alias.

@throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException

@return \eZ\Publish\Core\REST\Server\Values\CreatedURLAlias
Creates a new URL alias .