mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-10 08:16:12 +01:00
0a1a00dd22
Fixes #596
28 lines
712 B
PHP
28 lines
712 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace TTN\Tea\Domain\Repository\Traits;
|
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
|
|
|
|
/**
|
|
* This trait for repositories makes the repository ignore the storage page setting when fetching models.
|
|
*/
|
|
trait StoragePageAgnosticTrait
|
|
{
|
|
private QuerySettingsInterface $querySettings;
|
|
|
|
public function injectQuerySettings(QuerySettingsInterface $querySettings): void
|
|
{
|
|
$this->querySettings = $querySettings;
|
|
}
|
|
|
|
public function initializeObject(): void
|
|
{
|
|
$querySettings = clone $this->querySettings;
|
|
|
|
$querySettings->setRespectStoragePage(false);
|
|
$this->setDefaultQuerySettings($querySettings);
|
|
}
|
|
}
|