-
Notifications
You must be signed in to change notification settings - Fork 0
/
CityRepository.php
61 lines (54 loc) · 1.49 KB
/
CityRepository.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace FRD\FrdQuerybug\Domain\Repository;
/***
*
* This file is part of the "Query Test" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2017 Benjamin Rannow <b.rannow@familie-redlich.de>, Familie Redlich Digital
*
***/
use FRD\FrdQuerybug\Domain\Model\Store;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Persistence\Repository;
class CityRepository extends Repository
{
/**
* @var array
*/
//protected $defaultOrderings = [
// 'sorting' => QueryInterface::ORDER_ASCENDING
//];
/**
* Ignore storage UID
*
* @return CityRepository
*/
public function globalMode(): self
{
$settings = $this->createQuery()->getQuerySettings();
$settings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($settings);
return $this;
}
/**
* @param null|Store $line
* @return QueryResultInterface
*/
public function findByStore(?Store $store): QueryResultInterface
{
$query = $this->createQuery();
if ($store) {
$constrain = $query->logicalOr([
$query->contains('innerZone.stores', $store),
$query->contains('outerZone.stores', $store)
]);
$query->matching(
$constrain
);
}
return $query->execute();
}
}