CoolCMS API

RouteDefinition
in package

FinalYes

Serializable description of one dynamic front route.

Carries what the router needs to build the route through its factory, so no Doctrine entity ever reaches the router (see RouteTableBuilder). It is passed to the factory as $routeEntity and is the source of allowedPageIds for the whitelist (BaseRouteFactory).

factoryClass is already a normalized class name (never null, DefaultRouteFactory is resolved at build time) and module has no Front: prefix.

Table of Contents

Properties

$action  : string
$allowedPageIds  : array<string|int, mixed>
$factoryClass  : string
$id  : int
$mask  : string
$module  : string
$presenter  : string

Methods

__construct()  : mixed
fromArray()  : self
getId()  : int
toArray()  : array{id: int, mask: string, module: string, presenter: string, action: string, factory: string, pageIds: list}
asInt()  : int
Casts a decoded value to int; a non-scalar gives 0.
asString()  : string
Casts a decoded value to string; a non-scalar gives an empty string.

Properties

$allowedPageIds read-only

public array<string|int, mixed> $allowedPageIds

Methods

__construct()

public __construct(int $id, string $mask, string $module, string $presenter, string $action, string $factoryClass, array<int, int> $allowedPageIds) : mixed
Parameters
$id : int
$mask : string
$module : string
$presenter : string
$action : string
$factoryClass : string
$allowedPageIds : array<int, int>

whitelisted page ids (M2M page_route_rel); empty means no restriction

fromArray()

public static fromArray(array<string, mixed> $data) : self
Parameters
$data : array<string, mixed>
Tags
throws
InvalidArgumentException

when a key is missing or the shape is invalid (the caller treats it as a cache miss)

Return values
self

toArray()

public toArray() : array{id: int, mask: string, module: string, presenter: string, action: string, factory: string, pageIds: list}
Return values
array{id: int, mask: string, module: string, presenter: string, action: string, factory: string, pageIds: list}

asInt()

Casts a decoded value to int; a non-scalar gives 0.

private static asInt(mixed $value) : int
Parameters
$value : mixed
Return values
int

asString()

Casts a decoded value to string; a non-scalar gives an empty string.

private static asString(mixed $value) : string
Parameters
$value : mixed
Return values
string
On this page

Search results