Passed
Pull Request — master (#175)
by
unknown
07:46
created

AbstractRepository::crossClientFindAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
rs 10
1
<?php
2
namespace EWW\Dpf\Domain\Repository;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
/**
18
 * The abstract repository
19
 */
20
class AbstractRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
21
{
22
    /**
23
     * Finds all records of all clients.
24
     *
25
     * @param bool $returnRawQueryResult
26
     * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
27
     */
28
    public function crossClientFindAll($returnRawQueryResult = TRUE) {
29
        /** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */
30
        $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
31
        $querySettings->setRespectStoragePage(false);
32
        $this->setDefaultQuerySettings($querySettings);
33
        $query = $this->createQuery();
34
        return $query->execute($returnRawQueryResult);
35
    }
36
37
    /**
38
     * Finds all records with embargo date
39
     * @return mixed
40
     */
41
    public function crossClientEmbargoFindAll() {
42
        /** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */
43
        $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
44
        $querySettings->setRespectStoragePage(false);
45
        $this->setDefaultQuerySettings($querySettings);
46
        $query = $this->createQuery();
47
        $query->matching(
48
            $query->logicalAnd(
49
                array(
50
                    $query->logicalNot(
51
                        $query->equals('embargo_date', 0)
52
                    )
53
                )
54
            )
55
        );
56
        return $query->execute();
57
    }
58
59
}