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

Inheritance: implements Symfony\Cmf\Component\Routing\ChainedRouterInterface, implements Symfony\Component\Routing\Matcher\RequestMatcherInterface
Exibir arquivo Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$contentService eZ\Publish\API\Repository\ContentService
$generator eZ\Publish\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator
$locationService eZ\Publish\API\Repository\LocationService
$logger Psr\Log\LoggerInterface
$requestContext Symfony\Component\Routing\RequestContext
$rootLocationId integer | string Holds current root Location id.
$urlAliasService eZ\Publish\API\Repository\URLAliasService

Public Methods

Method Description
__construct ( eZ\Publish\API\Repository\LocationService $locationService, eZ\Publish\API\Repository\URLAliasService $urlAliasService, eZ\Publish\API\Repository\ContentService $contentService, UrlAliasGenerator $generator, Symfony\Component\Routing\RequestContext $requestContext, Psr\Log\LoggerInterface $logger = null )
generate ( string | eZ\Publish\API\Repository\Values\Content\Location $name, mixed $parameters = [], integer $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH ) : string Generates a URL for a location, from the given parameters.
getContext ( )
getRouteCollection ( ) : RouteCollection Gets the RouteCollection instance associated with this Router.
getRouteDebugMessage ( $name, array $parameters = [] )
match ( $pathinfo ) Not supported. Please use matchRequest() instead.
matchRequest ( Request $request ) : array Tries to match a request with a set of routes.
setContext ( Symfony\Component\Routing\RequestContext $context )
setRootLocationId ( integer | string $rootLocationId ) Injects current root Location id.
supports ( mixed $name ) : boolean Whether the router supports the thing in $name to generate a route.

Protected Methods

Method Description
getUrlAlias ( $pathinfo ) : eZ\Publish\API\Repository\Values\Content\URLAlias Returns the UrlAlias object to use, starting from the request.
needsCaseRedirect ( eZ\Publish\API\Repository\Values\Content\URLAlias $loadedUrlAlias, string $requestedPath, string $pathPrefix ) : boolean Returns true of false on comparing $urlAlias->path and $path with case sensitivity.
removePathPrefix ( string $path, string $prefix ) : string Removes prefix from path.

Method Details

__construct() public method

public __construct ( eZ\Publish\API\Repository\LocationService $locationService, eZ\Publish\API\Repository\URLAliasService $urlAliasService, eZ\Publish\API\Repository\ContentService $contentService, UrlAliasGenerator $generator, Symfony\Component\Routing\RequestContext $requestContext, Psr\Log\LoggerInterface $logger = null )
$locationService eZ\Publish\API\Repository\LocationService
$urlAliasService eZ\Publish\API\Repository\URLAliasService
$contentService eZ\Publish\API\Repository\ContentService
$generator eZ\Publish\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator
$requestContext Symfony\Component\Routing\RequestContext
$logger Psr\Log\LoggerInterface

generate() public method

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.
See also: UrlAliasRouter::supports()
public generate ( string | eZ\Publish\API\Repository\Values\Content\Location $name, mixed $parameters = [], integer $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH ) : string
$name string | eZ\Publish\API\Repository\Values\Content\Location The name of the route or a Location instance
$parameters mixed An array of parameters
$referenceType integer The type of reference to be generated (one of the constants)
return string The generated URL

getContext() public method

public getContext ( )

getRouteCollection() public method

Gets the RouteCollection instance associated with this Router.
public getRouteCollection ( ) : RouteCollection
return Symfony\Component\Routing\RouteCollection A RouteCollection instance

getRouteDebugMessage() public method

See also: Symfony\Cmf\Component\Routing\VersatileGeneratorInterface::getRouteDebugMessage()
public getRouteDebugMessage ( $name, array $parameters = [] )
$parameters array

getUrlAlias() protected method

Returns the UrlAlias object to use, starting from the request.
protected getUrlAlias ( $pathinfo ) : eZ\Publish\API\Repository\Values\Content\URLAlias
$pathinfo
return eZ\Publish\API\Repository\Values\Content\URLAlias

match() public method

Not supported. Please use matchRequest() instead.
public match ( $pathinfo )
$pathinfo

matchRequest() public method

If the matcher can not find information, it must throw one of the exceptions documented below.
public matchRequest ( Request $request ) : array
$request Symfony\Component\HttpFoundation\Request The request to match
return array An array of parameters

needsCaseRedirect() protected method

Used to determine if redirect is needed because requested path is case-different from the stored one.
protected needsCaseRedirect ( eZ\Publish\API\Repository\Values\Content\URLAlias $loadedUrlAlias, string $requestedPath, string $pathPrefix ) : boolean
$loadedUrlAlias eZ\Publish\API\Repository\Values\Content\URLAlias
$requestedPath string
$pathPrefix string
return boolean

removePathPrefix() protected method

Checks for presence of $prefix and removes it from $path if found.
protected removePathPrefix ( string $path, string $prefix ) : string
$path string
$prefix string
return string

setContext() public method

public setContext ( Symfony\Component\Routing\RequestContext $context )
$context Symfony\Component\Routing\RequestContext

setRootLocationId() public method

Injects current root Location id.
public setRootLocationId ( integer | string $rootLocationId )
$rootLocationId integer | string

supports() public method

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.
public supports ( mixed $name ) : boolean
$name mixed The route name or route object
return boolean

Property Details

$contentService protected_oe property

protected ContentService,eZ\Publish\API\Repository $contentService
return eZ\Publish\API\Repository\ContentService

$generator protected_oe property

protected UrlAliasGenerator,eZ\Publish\Core\MVC\Symfony\Routing\Generator $generator
return eZ\Publish\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator

$locationService protected_oe property

protected LocationService,eZ\Publish\API\Repository $locationService
return eZ\Publish\API\Repository\LocationService

$logger protected_oe property

protected LoggerInterface,Psr\Log $logger
return Psr\Log\LoggerInterface

$requestContext protected_oe property

protected RequestContext,Symfony\Component\Routing $requestContext
return Symfony\Component\Routing\RequestContext

$rootLocationId protected_oe property

Holds current root Location id.
protected int|string $rootLocationId
return integer | string

$urlAliasService protected_oe property

protected URLAliasService,eZ\Publish\API\Repository $urlAliasService
return eZ\Publish\API\Repository\URLAliasService