SHOW:
|
|
- or go back to the newest paste.
1 | - | /** |
1 | + | /** |
2 | * @param \Project\Package\Domain\Model\Event $event | |
3 | * @param string $status | |
4 | * @param string $noshow | |
5 | * @param \Project\Package\Domain\Model\Categorie $categorie | |
6 | * @return \TYPO3\Flow\Persistence\QueryResultInterface | |
7 | */ | |
8 | - | public function findByCategorieAndStateAndNoshow($event, $status, $noshow, \Projecte\Package\Domain\Model\Categorie $categorie = NULL) { |
8 | + | public function findByCategorieAndStateAndNoshow(\Project\Package\Domain\Model\Event $event, $status, $noshow, \Project\Package\Domain\Model\Categorie $categorie = NULL) { |
9 | $query = $this->createQuery(); | |
10 | - | if($categorie == NULL) { |
10 | + | if($categorie instanceof \Contenance\Event\Domain\Model\Categorie) { |
11 | - | if($status == NULL) { |
11 | + | $matchers[] = $query->equals('categorie', $categorie); |
12 | - | return $query->matching( |
12 | + | |
13 | - | $query->logicalAnd( |
13 | + | if($status) { |
14 | - | $query->equals('event', $event), |
14 | + | $matchers[] = $query->equals('state', $status); |
15 | - | $query->equals('noshow', $noshow) |
15 | + | |
16 | - | ) |
16 | + | if($noshow) { |
17 | - | )->execute()->toArray(); |
17 | + | $matchers[] = $query->equals('noshow', $noshow); |
18 | - | } else { |
18 | + | |
19 | - | return $query->matching( |
19 | + | $matchers[] = $query->equals('event', $event); |
20 | - | $query->logicalAnd( |
20 | + | |
21 | - | $query->equals('event', $event), |
21 | + | return $query->matching( |
22 | - | $query->equals('state', $status), |
22 | + | $query->logicalAnd($matchers) |
23 | - | $query->equals('noshow', $noshow) |
23 | + | )->execute()->toArray(); |
24 | - | ) |
24 | + |