SiteMatcher implements SingletonInterface

Returns a site based on a given request.

The main usage is the ->matchRequest() functionality, which receives a request object and boots up Symfony Routing to find the proper route with its defaults / attributes.

On top, this is also commonly used throughout TYPO3 to fetch a site by a given pageId. ->matchPageId().

The concept of the SiteMatcher is to resolve, and not build URIs. On top, it is a facade to hide the dependency to symfony and to not expose its logic.

Internal

Please note that the site matcher will be probably cease to exist and adapted to the SiteFinder concept when Pseudo-Site handling will be removed.

Table of Contents

Interfaces

SingletonInterface
"empty" interface for singletons (marker interface pattern)

Properties

$features  : Features
$finder  : SiteFinder
$requestContextFactory  : RequestContextFactory

Methods

__construct()  : mixed
matchByPageId()  : SiteInterface
If a given page ID is handed in, a Site/NullSite is returned.
matchRequest()  : RouteResultInterface
First, it is checked, if a "id" GET/POST parameter is found.
refresh()  : mixed
Only used when a page is moved but the pseudo site caches has this information hard-coded, so the caches need to be flushed.
canonicalizeUri()  : UriInterface
Remove script file name (index.php) from request uri
getRouteCollectionForAllSites()  : RouteCollection
Returns a Symfony RouteCollection containing all routes to all sites.
matchSiteByQueryParams()  : SiteRouteResult
matchSiteByUri()  : SiteRouteResult
resolveLanguageIdQueryParam()  : positive-int|null
resolvePageIdQueryParam()  : positive-int|null

Properties

Methods

matchByPageId()

If a given page ID is handed in, a Site/NullSite is returned.

public matchByPageId(int $pageId[, array<string|int, mixed>|null $rootLine = null ]) : SiteInterface
Parameters
$pageId : int

uid of a page in default language

$rootLine : array<string|int, mixed>|null = null

an alternative root line, if already at and.

Return values
SiteInterface

matchRequest()

First, it is checked, if a "id" GET/POST parameter is found.

public matchRequest(ServerRequestInterface $request) : RouteResultInterface

If it is, we check for a valid site mounted there.

If it isn't the quest continues by validating the whole request URL and validating against all available site records (and their language prefixes).

Parameters
$request : ServerRequestInterface
Return values
RouteResultInterface

refresh()

Only used when a page is moved but the pseudo site caches has this information hard-coded, so the caches need to be flushed.

public refresh() : mixed
Internal
Tags
throws
NoSuchCacheException

canonicalizeUri()

Remove script file name (index.php) from request uri

protected canonicalizeUri(UriInterface $uri, ServerRequestInterface $request) : UriInterface
Parameters
$uri : UriInterface
$request : ServerRequestInterface
Return values
UriInterface

matchSiteByUri()

protected matchSiteByUri(UriInterface $uri, ServerRequestInterface $request) : SiteRouteResult
Parameters
$uri : UriInterface
$request : ServerRequestInterface
Return values
SiteRouteResult

resolveLanguageIdQueryParam()

protected resolveLanguageIdQueryParam(ServerRequestInterface $request) : positive-int|null
Parameters
$request : ServerRequestInterface
Return values
positive-int|null

resolvePageIdQueryParam()

protected resolvePageIdQueryParam(ServerRequestInterface $request) : positive-int|null
Parameters
$request : ServerRequestInterface
Return values
positive-int|null

        
On this page

Search results