mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-21 20:36:12 +01:00
[TASK][!!!] Require a storage PID for the tea list (#1223)
Fixes #1024 Supersedes #1024
This commit is contained in:
parent
a014ea7efb
commit
248c759206
7 changed files with 8 additions and 39 deletions
|
@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|||
### Added
|
||||
|
||||
### Changed
|
||||
- !!! Require a storage PID for the tea list (#1223)
|
||||
- Drop additional namespace segment for the Tea model (#1025)
|
||||
|
||||
### Deprecated
|
||||
|
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||
namespace TTN\Tea\Domain\Repository;
|
||||
|
||||
use TTN\Tea\Domain\Model\Tea;
|
||||
use TTN\Tea\Domain\Repository\Traits\StoragePageAgnosticTrait;
|
||||
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
|
||||
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
|
||||
use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||
|
@ -15,8 +14,6 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
|
|||
*/
|
||||
class TeaRepository extends Repository
|
||||
{
|
||||
use StoragePageAgnosticTrait;
|
||||
|
||||
protected $defaultOrderings = ['title' => QueryInterface::ORDER_ASCENDING];
|
||||
|
||||
/**
|
||||
|
@ -25,6 +22,7 @@ class TeaRepository extends Repository
|
|||
public function findByOwnerUid(int $ownerUid): QueryResultInterface
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
$query->setQuerySettings($query->getQuerySettings()->setRespectStoragePage(false));
|
||||
$query->matching($query->equals('ownerUid', $ownerUid));
|
||||
|
||||
return $query->execute();
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace TTN\Tea\Domain\Repository\Traits;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
|
||||
|
||||
/**
|
||||
* This trait for repositories makes the repository ignore the storage page setting when fetching models.
|
||||
*/
|
||||
trait StoragePageAgnosticTrait
|
||||
{
|
||||
public function initializeObject(): void
|
||||
{
|
||||
$querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class);
|
||||
$querySettings->setRespectStoragePage(false);
|
||||
$this->setDefaultQuerySettings($querySettings);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
plugin.tx_tea {
|
||||
persistence {
|
||||
storagePid = 2
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ final class TeaControllerTest extends FunctionalTestCase
|
|||
'constants' => [
|
||||
'EXT:fluid_styled_content/Configuration/TypoScript/constants.typoscript',
|
||||
'EXT:tea/Configuration/TypoScript/constants.typoscript',
|
||||
'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Constants/PluginConfiguration.typoscript',
|
||||
],
|
||||
'setup' => [
|
||||
'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript',
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
"tx_tea_domain_model_tea"
|
||||
,"uid","pid","title"
|
||||
,1,1,"Earl Grey"
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
@ -41,18 +41,6 @@ final class TeaRepositoryTest extends FunctionalTestCase
|
|||
self::assertCount(0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function findAllWithRecordsFindsRecordsFromAllPages(): void
|
||||
{
|
||||
$this->importCSVDataSet(__DIR__ . '/Fixtures/TeaOnPage.csv');
|
||||
|
||||
$result = $this->subject->findAll();
|
||||
|
||||
self::assertCount(1, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue