PersistedPatternMapper implements PersistedMappableAspectInterface, StaticMappableAspectInterface, SiteLanguageAwareInterface, SiteAwareInterface, UnresolvedValueInterface uses AspectTrait, SiteLanguageAccessorTrait, SiteAccessorTrait, UnresolvedValueTrait

Very useful for building a path segment from a combined value of the database.

Please note: title is not prepared for slugs and used raw.

Example: routeEnhancers: EventsPlugin: type: Extbase extension: Events2 plugin: Pi1 routes: - { routePath: '/events/{event}', _controller: 'Event::detail', _arguments: {'event': 'event_name'}} defaultController: 'Events2::list' aspects: event: type: PersistedPatternMapper tableName: 'tx_events2_domain_model_event' routeFieldPattern: '^(?P<title>.+)-(?P\d+)$' routeFieldResult: '{title}-{uid}'

Internal

might change its options in the future, be aware that there might be modifications.

Table of Contents

Interfaces

PersistedMappableAspectInterface
Used for anything that invokes (more expensive) persistence invocations.
StaticMappableAspectInterface
Used for anything that has a fixed list of values mapped against route arguments.
SiteLanguageAwareInterface
Interface for SiteLanguageAware features of TYPO3
SiteAwareInterface
Interface for SiteAware features of TYPO3
UnresolvedValueInterface
Provides fallback values for unresolved values during processing mappers.

Constants

PATTERN_RESULT  = '#\{(?P<fieldName>[^}]+)\}#'

Properties

$languageAspect  : LanguageAspect
$languageFieldName  : string|null
$languageParentFieldName  : string|null
$routeFieldPattern  : string
$routeFieldResult  : string
$routeFieldResultNames  : array<string|int, string>
$settings  : array<string|int, mixed>
$site  : Site
$siteMatcher  : SiteMatcher|null
$slugUniqueInSite  : bool
$tableName  : string

Methods

__construct()  : mixed
generate()  : string|null
getFallbackValue()  : string|null
getSite()  : Site
hasFallbackValue()  : bool
resolve()  : string|null
setSite()  : void
createPageRepository()  : PageRepository
createQueryBuilder()  : QueryBuilder
createRouteFieldConstraints()  : array<string|int, mixed>
createRouteResult()  : string|null
filterContainedInSite()  : array<string|int, mixed>
Filters records that are contained in current site (resolved from current SiteLanguage).
filterNamesKeys()  : array<string|int, mixed>
findByIdentifier()  : array<string|int, mixed>|null
findByRouteFieldValues()  : array<string|int, mixed>|null
getLanguageAspect()  : LanguageAspect
Provides LanguageAspect which contains the logic how fallbacks for a given context/overlay-mode shall be handled.
getSiteMatcher()  : SiteMatcher
hasSlugUniqueInSite()  : bool
isPageIdContainedInSite()  : bool
Determines whether page is contained in current site (resolved from current SiteLanguage).
isSlugUniqueInSite()  : bool
resolveAllRelevantLanguageIds()  : array<string|int, int>
Resolves all language ids that are relevant to retrieve the most specific variant of a record.
resolveLanguageFallback()  : array<string|int, mixed>|null
Resolves one record out of given language fallbacks.
resolveOverlay()  : array<string|int, mixed>|null

Constants

PATTERN_RESULT

protected mixed PATTERN_RESULT = '#\{(?P<fieldName>[^}]+)\}#'

Properties

$languageFieldName

protected string|null $languageFieldName

$languageParentFieldName

protected string|null $languageParentFieldName

$routeFieldPattern

protected string $routeFieldPattern

$routeFieldResult

protected string $routeFieldResult

$routeFieldResultNames

protected array<string|int, string> $routeFieldResultNames

$settings

protected array<string|int, mixed> $settings

$slugUniqueInSite

protected bool $slugUniqueInSite

Methods

__construct()

public __construct(array<string|int, mixed> $settings) : mixed
Parameters
$settings : array<string|int, mixed>
Tags
throws
InvalidArgumentException

generate()

public generate(string $value) : string|null
Parameters
$value : string
Return values
string|null

getFallbackValue()

public getFallbackValue() : string|null
Return values
string|null

hasFallbackValue()

public hasFallbackValue() : bool
Return values
bool

resolve()

public resolve(string $value) : string|null
Parameters
$value : string
Return values
string|null

createRouteFieldConstraints()

protected createRouteFieldConstraints(QueryBuilder $queryBuilder, array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$queryBuilder : QueryBuilder
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

createRouteResult()

protected createRouteResult(array<string|int, mixed>|null $result) : string|null
Parameters
$result : array<string|int, mixed>|null
Tags
throws
InvalidArgumentException
Return values
string|null

filterContainedInSite()

Filters records that are contained in current site (resolved from current SiteLanguage).

protected filterContainedInSite(array<string|int, mixed> $results) : array<string|int, mixed>

Results keep original indexes and probably needs to be passed through array_values for e.g. using the first result by $results[0].

Parameters
$results : array<string|int, mixed>
Return values
array<string|int, mixed>

filterNamesKeys()

protected filterNamesKeys(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
Return values
array<string|int, mixed>

findByIdentifier()

protected findByIdentifier(string $value) : array<string|int, mixed>|null
Parameters
$value : string
Return values
array<string|int, mixed>|null

findByRouteFieldValues()

protected findByRouteFieldValues(array<string|int, mixed> $values) : array<string|int, mixed>|null
Parameters
$values : array<string|int, mixed>
Return values
array<string|int, mixed>|null

getLanguageAspect()

Provides LanguageAspect which contains the logic how fallbacks for a given context/overlay-mode shall be handled.

protected getLanguageAspect() : LanguageAspect
Tags
see
LanguageAspectFactory::createFromSiteLanguage
Return values
LanguageAspect

hasSlugUniqueInSite()

protected hasSlugUniqueInSite(string $tableName, string ...$fieldNames) : bool
Parameters
$tableName : string
$fieldNames : string
Return values
bool

isPageIdContainedInSite()

Determines whether page is contained in current site (resolved from current SiteLanguage).

protected isPageIdContainedInSite(int $pageId) : bool
Parameters
$pageId : int
Return values
bool

isSlugUniqueInSite()

protected isSlugUniqueInSite(string $tableName, string $fieldName) : bool
Parameters
$tableName : string
$fieldName : string
Return values
bool

resolveAllRelevantLanguageIds()

Resolves all language ids that are relevant to retrieve the most specific variant of a record.

protected resolveAllRelevantLanguageIds() : array<string|int, int>

The order of these ids defines the processing order concerning language fallback - most specific language comes first in this array.

  • "all language (-1)", most specific if present since there cannot be any localizations
  • "current language" most specific for the current given request context
  • "language fallbacks" falling back to language alternatives (might include "default language")
Return values
array<string|int, int>

resolveLanguageFallback()

Resolves one record out of given language fallbacks.

protected resolveLanguageFallback(array<string|int, mixed> $results, string|null $languageFieldName, array<string|int, mixed>|null $languageIds) : array<string|int, mixed>|null
Parameters
$results : array<string|int, mixed>
$languageFieldName : string|null
$languageIds : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

resolveOverlay()

protected resolveOverlay(array<string|int, mixed>|null $record) : array<string|int, mixed>|null
Parameters
$record : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

        
On this page

Search results