PersistedAliasMapper

class \TYPO3\CMS\Core\Routing\Aspect\PersistedAliasMapper

Implements
PersistedMappableAspectInterface, StaticMappableAspectInterface, ContextAwareInterface, SiteLanguageAwareInterface, SiteAwareInterface, UnresolvedValueInterface
Uses
AspectTrait, SiteLanguageAccessorTrait, SiteAccessorTrait, ContextAwareTrait, UnresolvedValueTrait

Classic usage when using a "URL segment" (e.g. slug) field within a database table.

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: PersistedAliasMapper tableName: 'tx_events2_domain_model_event' routeFieldName: 'path_segment' routeValuePrefix: '/'

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.
ContextAwareInterface
SiteLanguageAwareInterface
Interface for SiteLanguageAware features of TYPO3
SiteAwareInterface
Interface for SiteAware features of TYPO3
UnresolvedValueInterface
Provides fallback values for unresolved values during processing mappers.

Properties

$context  : Context
$languageAspect  : LanguageAspect
$languageFieldName  : string|null
$languageParentFieldName  : string|null
$persistenceFieldNames  : string[]
$routeFieldName  : string
$routeValuePrefix  : string
$settings  : array
$site  : Site
$siteMatcher  : SiteMatcher|null
$slugUniqueInSite  : bool
$tableName  : string

Methods

__construct()  : mixed
generate()  : string|null
getContext()  : Context
getFallbackValue()  : string|null
getSite()  : Site
hasFallbackValue()  : bool
resolve()  : string|null
setContext()  : void
setSite()  : void
buildPersistenceFieldNames()  : string[]
createPageRepository()  : PageRepository
createQueryBuilder()  : QueryBuilder
filterContainedInSite()  : array
Filters records that are contained in current site (resolved from current SiteLanguage).
findByIdentifier()  : array|null
findByRouteFieldValue()  : array|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
purgeRouteValuePrefix()  : string
resolveAllRelevantLanguageIds()  : int[]
Resolves all language ids that are relevant to retrieve the most specific variant of a record.
resolveLanguageFallback()  : array|null
Resolves one record out of given language fallbacks.
resolveOverlay()  : array|null

Properties

$languageFieldName

protected string|null $languageFieldName

$languageParentFieldName

protected string|null $languageParentFieldName

$persistenceFieldNames

protected string[] $persistenceFieldNames

$routeFieldName

protected string $routeFieldName

$routeValuePrefix

protected string $routeValuePrefix

$slugUniqueInSite

protected bool $slugUniqueInSite

Methods

__construct()

public __construct(array $settings) : mixed

Parameters

$settings : array

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

buildPersistenceFieldNames()

protected buildPersistenceFieldNames() : string[]

Return values

string[]

filterContainedInSite()

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

protected filterContainedInSite(array $results) : array

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

Return values

array

findByIdentifier()

protected findByIdentifier(string $value) : array|null

Parameters

$value : string

Return values

array|null

findByRouteFieldValue()

protected findByRouteFieldValue(string $value) : array|null

Parameters

$value : string

Return values

array|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

purgeRouteValuePrefix()

protected purgeRouteValuePrefix(string|null $value) : string

Parameters

$value : string|null

Return values

string

resolveAllRelevantLanguageIds()

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

protected resolveAllRelevantLanguageIds() : 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

int[]

resolveLanguageFallback()

Resolves one record out of given language fallbacks.

protected resolveLanguageFallback(array $results, string|null $languageFieldName, array|null $languageIds) : array|null

Parameters

$results : array
$languageFieldName : string|null
$languageIds : array|null

Return values

array|null

resolveOverlay()

protected resolveOverlay(array|null $record) : array|null

Parameters

$record : array|null

Return values

array|null
On this page