mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-26 17:36:13 +01:00
e469041db7
The `@var` annotations where left where it is not possible yet to replace them in PHP 7.4. Fixes #550 Co-authored-by: lina.wolf <lwolf@w-commerce.de>
31 lines
819 B
PHP
31 lines
819 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace TTN\Tea\Domain\Repository\Traits;
|
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
|
|
use TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface;
|
|
|
|
/**
|
|
* This trait for repositories makes the repository ignore the storage page setting when fetching models.
|
|
*
|
|
* @property ObjectManagerInterface $objectManager
|
|
*/
|
|
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);
|
|
}
|
|
}
|