ProductDetailRouteFactory
extends BaseRouteFactory
in package
Builds the route of the product set detail in the catalog.
Mask: [<loc>/]<slug>/<name>-s<id>. Only id is matched; name is an SEO decoration that
addDerivedParameter() fills in when a URL is generated from the id. The parse-direction
closure of addStringTranslation() always returns null, so an arbitrary or outdated name in
the URL still leads to the correct product.
Table of Contents
Properties
- $routeManager : RouteManager
- $pageSlugTranslator : PageSlugTranslator
- $productSetNameTranslator : ProductSetNameTranslator
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
$productSetNameTranslator read-only
private
ProductSetNameTranslator
$productSetNameTranslator
Methods
__construct()
public
__construct(RouteManager $routeManager, PageSlugTranslator $pageSlugTranslator, ProductSetNameTranslator $productSetNameTranslator) : mixed
Parameters
- $routeManager : RouteManager
- $pageSlugTranslator : PageSlugTranslator
- $productSetNameTranslator : ProductSetNameTranslator
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