StaticRangeMapper

class \TYPO3\CMS\Core\Routing\Aspect\StaticRangeMapper

Implements
StaticMappableAspectInterface, Countable

Very useful for e.g. pagination or static range like "2011 ... 2030" for years.

Example: routeEnhancers: MyBlogPlugin: type: Extbase extension: BlogExample plugin: Pi1 routes: - { routePath: '/list/{paging_widget}', _controller: 'BlogExample::list', _arguments: {'paging_widget': '@widget_0/currentPage'}} - { routePath: '/glossary/{section}', _controller: 'BlogExample::glossary'} defaultController: 'BlogExample::list' requirements: paging_widget: '\d+' aspects: paging_widget: type: StaticRangeMapper start: '1' end: '100' section: type: StaticRangeMapper start: 'a' end: 'z'

Table of Contents

Interfaces

StaticMappableAspectInterface
Used for anything that has a fixed list of values mapped against route arguments.
Countable

Properties

$end  : string
$range  : string[]
$settings  : array
$start  : string

Methods

__construct()  : mixed
count()  : int
{@inheritdoc}
generate()  : string|null
resolve()  : string|null
applyNumericPrefix()  : string[]
buildRange()  : string[]
Builds range based on given settings and ensures each item is string.
respondWhenInRange()  : string|null

Properties

Methods

__construct()

public __construct(array $settings) : mixed

Parameters

$settings : array

Tags

throws
InvalidArgumentException

count()

{@inheritdoc}

public count() : int

Return values

int

generate()

public generate(string $value) : string|null

Parameters

$value : string

Return values

string|null

resolve()

public resolve(string $value) : string|null

Parameters

$value : string

Return values

string|null

applyNumericPrefix()

protected applyNumericPrefix(array $range) : string[]

Parameters

$range : array

Return values

string[]

buildRange()

Builds range based on given settings and ensures each item is string.

protected buildRange() : string[]

The amount of items is limited to 1000 in order to avoid brute-force scenarios and the risk of cache-flooding.

In case that is not enough, creating a custom and more specific mapper is encouraged. Using high values that are not distinct exposes the site to the risk of cache-flooding.

Tags

throws
LengthException

Return values

string[]

respondWhenInRange()

protected respondWhenInRange(string $value) : string|null

Parameters

$value : string

Return values

string|null
On this page