‪TYPO3CMS  ‪main
TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository Class Reference

Public Member Functions

 __construct (private readonly EventDispatcherInterface $eventDispatcher, private readonly ConnectionPool $connectionPool, private readonly Context $context,)
 
 getSysTemplateRowsByRootline (array $rootline, ?ServerRequestInterface $request=null)
 
 getSysTemplateRowsByRootlineWithUidOverride (array $rootline, ?ServerRequestInterface $request, int $templateUidOnDeepestRootline)
 

Private Member Functions

 getSysTemplateQueryRestrictionContainer ()
 

Detailed Description

Fetch relevant sys_template records from database by given page rootline.

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

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

Definition at line 38 of file SysTemplateRepository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository::__construct ( private readonly EventDispatcherInterface  $eventDispatcher,
private readonly ConnectionPool  $connectionPool,
private readonly Context  $context 
)

Definition at line 40 of file SysTemplateRepository.php.

Member Function Documentation

◆ getSysTemplateQueryRestrictionContainer()

TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository::getSysTemplateQueryRestrictionContainer ( )
private

Get sys_template record query builder restrictions. Allows hidden records if enabled in context.

Definition at line 195 of file SysTemplateRepository.php.

Referenced by TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository\getSysTemplateRowsByRootline(), and TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository\getSysTemplateRowsByRootlineWithUidOverride().

◆ getSysTemplateRowsByRootline()

TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository::getSysTemplateRowsByRootline ( array  $rootline,
?ServerRequestInterface  $request = null 
)

To calculate the TS include tree, we have to find sys_template rows attached to all rootline pages. 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
ServerRequestInterface | null$request‪Nullable since Request is not a hard dependency ond just convenient for the Event
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.

Definition at line 61 of file SysTemplateRepository.php.

References TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository\getSysTemplateQueryRestrictionContainer(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

◆ getSysTemplateRowsByRootlineWithUidOverride()

TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository::getSysTemplateRowsByRootlineWithUidOverride ( array  $rootline,
?ServerRequestInterface  $request,
int  $templateUidOnDeepestRootline 
)

To calculate the TS include tree, we have to find sys_template rows attached to all rootline pages. 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.

Definition at line 124 of file SysTemplateRepository.php.

References TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository\getSysTemplateQueryRestrictionContainer(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.