DefaultRouteFactory
extends BaseRouteFactory
in package
Builds the page route with slug translation and a page whitelist.
Also the fallback for routes without a factory. PageRouteFactory and PageShowRouteFactory
extend it so that existing database records keep working.
Table of Contents
Properties
Methods
- __construct() : mixed
- create() : RestrictedTranslatableRoute
- Creates the `TranslatableRoute` instance.
- applyWhitelist() : void
- Restricts a route parameter to the page ids whitelisted in the route definition.
- getPageIdsFromEntity() : array<string|int, int>
- Returns the allowed page ids from the route definition (precomputed, no database query).
Properties
$routeManager read-only
protected
RouteManager
$routeManager
$pageSlugTranslator read-only
private
PageSlugTranslator
$pageSlugTranslator
Methods
__construct()
public
__construct(RouteManager $routeManager, PageSlugTranslator $pageSlugTranslator) : mixed
Parameters
- $routeManager : RouteManager
- $pageSlugTranslator : PageSlugTranslator
create()
Creates the `TranslatableRoute` instance.
public
create(string $mask, string $module, string $presenter, string $action[, int|null $routeId = null ][, RouteDefinition|null $routeEntity = null ]) : RestrictedTranslatableRoute
Parameters
- $mask : string
-
URL mask (e.g. '
/[ ]') - $module : string
-
module name (System, Blog, ...)
- $presenter : string
-
presenter name (Page, Article, ...)
- $action : string
-
action name (show, detail, ...)
- $routeId : int|null = null
-
route id from the database
- $routeEntity : RouteDefinition|null = null
-
already loaded definition with its pages
Return values
RestrictedTranslatableRouteapplyWhitelist()
Restricts a route parameter to the page ids whitelisted in the route definition.
protected
applyWhitelist(RestrictedTranslatableRoute $route[, RouteDefinition|null $routeEntity = null ][, string $paramName = 'slug' ]) : void
Parameters
- $route : RestrictedTranslatableRoute
-
route to restrict
- $routeEntity : RouteDefinition|null = null
-
definition with precomputed allowed pages; null applies no restriction
- $paramName : string = 'slug'
-
parameter to restrict (default 'slug')
getPageIdsFromEntity()
Returns the allowed page ids from the route definition (precomputed, no database query).
protected
getPageIdsFromEntity(RouteDefinition $routeEntity) : array<string|int, int>
Parameters
- $routeEntity : RouteDefinition