mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-14 22:56:14 +01:00
tea/Classes/Domain/Repository/Product/TeaRepository.php
Oliver Klee bbe469169b
[FEATURE] Add Tea.ownerUid (#860)
This is a pre-patch for adding a CRUD plugin for tea records.

This property contains only the UID of the owner FE user, but not
a relation to a FE user model. This is because we neither have nor
need a FE user model for the purposes of the CRUD plugin.
2023-06-21 09:16:13 +02:00

32 lines
804 B
PHP

<?php
declare(strict_types=1);
namespace TTN\Tea\Domain\Repository\Product;
use TTN\Tea\Domain\Model\Product\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;
/**
* @extends Repository<Tea>
*/
class TeaRepository extends Repository
{
use StoragePageAgnosticTrait;
protected $defaultOrderings = ['title' => QueryInterface::ORDER_ASCENDING];
/**
* @param positive-int $ownerUid
*/
public function findByOwnerUid(int $ownerUid): QueryResultInterface
{
$query = $this->createQuery();
$query->matching($query->equals('ownerUid', $ownerUid));
return $query->execute();
}
}