Class

eZ\Bundle\EzPublishCoreBundle\Routing\UrlAliasRouter

class UrlAliasRouter extends UrlAliasRouter

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)

from UrlAliasRouter
setRootLocationId(int|string $rootLocationId)

Injects current root Location id.

from UrlAliasRouter
array matchRequest(Request $request)

Tries to match a request with a set of routes.

RouteCollection getRouteCollection()

Gets the RouteCollection instance associated with this Router.

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

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

from UrlAliasRouter
setContext(RequestContext $context)

from UrlAliasRouter
getContext()

from UrlAliasRouter
match($pathinfo $pathinfo)

Not supported.

from UrlAliasRouter
bool supports(mixed $name)

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

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

from UrlAliasRouter
setConfigResolver(ConfigResolverInterface $configResolver)

Details

in UrlAliasRouter 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

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

Injects current root Location id.

Parameters

int|string $rootLocationId

at line 31
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

in UrlAliasRouter at line 287
public RouteCollection getRouteCollection()

Gets the RouteCollection instance associated with this Router.

Return Value

RouteCollection A RouteCollection instance

in UrlAliasRouter 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()

in UrlAliasRouter at line 363
public setContext(RequestContext $context)

Parameters

RequestContext $context

in UrlAliasRouter at line 369
public getContext()

in UrlAliasRouter at line 381
public match($pathinfo $pathinfo)

Not supported.

Please use matchRequest() instead.

Parameters

$pathinfo $pathinfo

Exceptions

RuntimeException

in UrlAliasRouter 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

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

Parameters

$name
array $parameters

See also

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

at line 26
public setConfigResolver(ConfigResolverInterface $configResolver)

Parameters

ConfigResolverInterface $configResolver