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:
Oliver Klee 2024-04-15 11:13:57 +02:00 committed by GitHub
parent a014ea7efb
commit 248c759206
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 8 additions and 39 deletions

View file

@ -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

View file

@ -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();

View file

@ -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);
}
}

View file

@ -0,0 +1,5 @@
plugin.tx_tea {
persistence {
storagePid = 2
}
}

View file

@ -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',

View file

@ -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.

View file

@ -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
*/