Class

eZ\Publish\Core\MVC\Symfony\Routing\UrlAliasRouter

class UrlAliasRouter implements ChainedRouterInterface, RequestMatcherInterface

Constants

URL_ALIAS_ROUTE_NAME

LOCATION_VIEW_CONTROLLER

VIEW_ACTION

Methods

__construct(LocationService $locationService, URLAliasService $urlAliasService, ContentService $contentService, UrlAliasGenerator $generator, RequestContext $requestContext, LoggerInterface $logger = null)

setRootLocationId(int|string $rootLocationId)

Injects current root Location id.

array matchRequest(Request $request)

Tries to match a request with a set of routes.

RouteCollection getRouteCollection()

Gets the RouteCollection instance associated with this Router.

string generate(string|Location $name, mixed $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Generates a URL for a location, from the given parameters.

setContext(RequestContext $context)

getContext()

match($pathinfo $pathinfo)

Not supported.

bool supports(mixed $name)

Whether the router supports the thing in $name to generate a route.

getRouteDebugMessage($name, array $parameters = array())

Details

at line 84
public __construct(LocationService $locationService, URLAliasService $urlAliasService, ContentService $contentService, UrlAliasGenerator $generator, RequestContext $requestContext, LoggerInterface $logger = null)

Parameters

LocationService $locationService
URLAliasService $urlAliasService
ContentService $contentService
UrlAliasGenerator $generator
RequestContext $requestContext
LoggerInterface $logger

at line 105
public setRootLocationId(int|string $rootLocationId)

Injects current root Location id.

Parameters

int|string $rootLocationId

at line 122
public array matchRequest(Request $request)

Tries to match a request with a set of routes.

If the matcher can not find information, it must throw one of the exceptions documented below.

Parameters

Request $request The request to match

Return Value

array An array of parameters

Exceptions

ResourceNotFoundException If no matching resource could be found

at line 287
public RouteCollection getRouteCollection()

Gets the RouteCollection instance associated with this Router.

Return Value

RouteCollection A RouteCollection instance

at line 317
public string generate(string|Location $name, mixed $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)

Generates a URL for a location, from the given parameters.

It is possible to directly pass a Location object as the route name, as the ChainRouter allows it through ChainedRouterInterface.

If $name is a route name, the "location" key in $parameters must be set to a valid eZ\Publish\API\Repository\Values\Content\Location object. "locationId" can also be provided.

If the generator is not able to generate the url, it must throw the RouteNotFoundException as documented below.

Parameters

string|Location $name The name of the route or a Location instance
mixed $parameters An array of parameters
int $referenceType The type of reference to be generated (one of the constants)

Return Value

string The generated URL

Exceptions

LogicException
RouteNotFoundException
InvalidArgumentException

See also

UrlAliasRouter::supports()

at line 363
public setContext(RequestContext $context)

Parameters

RequestContext $context

at line 369
public getContext()

at line 381
public match($pathinfo $pathinfo)

Not supported.

Please use matchRequest() instead.

Parameters

$pathinfo $pathinfo

Exceptions

RuntimeException

at line 397
public bool supports(mixed $name)

Whether the router supports the thing in $name to generate a route.

This check does not need to look if the specific instance can be resolved to a route, only whether the router can generate routes from objects of this class.

Parameters

mixed $name The route name or route object

Return Value

bool

at line 405
public getRouteDebugMessage($name, array $parameters = array())

Parameters

$name
array $parameters

See also

Symfony\Cmf\Component\Routing\VersatileGeneratorInterface::getRouteDebugMessage()