2018-05-25 16:19:12 +02:00
|
|
|
<?php
|
2019-12-07 12:13:32 +01:00
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-12-01 12:16:06 +01:00
|
|
|
namespace TTN\Tea\Domain\Repository\Traits;
|
2018-05-25 16:19:12 +02:00
|
|
|
|
2019-08-12 17:43:02 +02:00
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
2018-05-25 16:19:12 +02:00
|
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This trait for repositories makes the repository ignore the storage page setting when fetching models.
|
|
|
|
*
|
2019-08-12 17:43:02 +02:00
|
|
|
* @property ObjectManagerInterface $objectManager
|
2018-05-25 16:19:12 +02:00
|
|
|
*/
|
|
|
|
trait StoragePageAgnosticTrait
|
|
|
|
{
|
2022-10-03 19:00:55 +02:00
|
|
|
private QuerySettingsInterface $querySettings;
|
2022-03-02 02:07:25 +01:00
|
|
|
|
|
|
|
public function injectQuerySettings(QuerySettingsInterface $querySettings): void
|
|
|
|
{
|
|
|
|
$this->querySettings = $querySettings;
|
|
|
|
}
|
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
public function initializeObject(): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2022-03-02 02:07:25 +01:00
|
|
|
$querySettings = clone $this->querySettings;
|
|
|
|
|
2018-05-25 16:19:12 +02:00
|
|
|
$querySettings->setRespectStoragePage(false);
|
|
|
|
$this->setDefaultQuerySettings($querySettings);
|
|
|
|
}
|
|
|
|
}
|