SysTemplateRepository

Read onlyYes
FinalYes

Fetch relevant sys_template records from database by given page rootline.

The result sys_template rows are fed to the SysTemplateTreeBuilder for processing.

Tags
internal:

Internal structure. There is optimization potential and especially getSysTemplateRowsByRootline() will probably vanish later.

Attributes
#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
getSysTemplateRowsByRootline()  : array<string|int, mixed>
To calculate the TS include tree, we have to find sys_template rows attached to all rootline pages.
getSysTemplateRowsByRootlineWithUidOverride()  : array<string|int, mixed>
To calculate the TS include tree, we have to find sys_template rows attached to all rootline pages.

Methods

getSysTemplateRowsByRootline()

To calculate the TS include tree, we have to find sys_template rows attached to all rootline pages.

public getSysTemplateRowsByRootline(array<string|int, mixed> $rootline[, ServerRequestInterface|null $request = null ]) : array<string|int, mixed>

When there are multiple active sys_template rows on a page, we pick the one with the lower sorting value.

The query implementation below does that with one query for all rootline pages at once, not one query per page. To handle the capabilities mentioned above, the query is a bit nifty, but the implementation should scale nearly O(1) instead of O(n) with the rootline depth.

Parameters
$rootline : array<string|int, mixed>
$request : ServerRequestInterface|null = null

Nullable since Request is not a hard dependency ond just convenient for the Event

Tags
todo:

It's potentially possible to get rid of this method in the frontend by joining sys_template into the Page rootline resolving as soon as it uses a CTE: This would save one query in all FE requests, even for fully-cached page requests.

Return values
array<string|int, mixed>

getSysTemplateRowsByRootlineWithUidOverride()

To calculate the TS include tree, we have to find sys_template rows attached to all rootline pages.

public getSysTemplateRowsByRootlineWithUidOverride(array<string|int, mixed> $rootline, ServerRequestInterface|null $request, int $templateUidOnDeepestRootline) : array<string|int, mixed>

When there are multiple active sys_template rows on a page, we pick the one with the lower sorting value.

This variant is tailored for ext:tstemplate use. It allows "overriding" the sys_template uid of the deepest page, which is used when multiple sys_template records on one page are managed in the Backend.

The query implementation below does that with one query for all rootline pages at once, not one query per page. To handle the capabilities mentioned above, the query is a bit nifty, but the implementation should scale nearly O(1) instead of O(n) with the rootline depth.

Parameters
$rootline : array<string|int, mixed>
$request : ServerRequestInterface|null
$templateUidOnDeepestRootline : int
Return values
array<string|int, mixed>

        
On this page

Search results