Passed
Push — master ( 134b43...f02d33 )
by Ralf
09:50
created

FrontendUserRepository::isUserInClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 13
rs 10
cc 1
nc 1
nop 2
1
<?php
2
namespace EWW\Dpf\Domain\Repository;
3
4
use EWW\Dpf\Domain\Model\Document;
5
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
6
7
class FrontendUserRepository extends \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
8
{
9
    /**
10
     * @param $feUserUid
11
     * @param $clientPid
12
     * @return bool
13
     */
14
    public function isUserInClient($feUserUid, $clientPid)
15
    {
16
        /** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */
17
        $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
18
        $querySettings->setRespectStoragePage(false);
19
        $this->setDefaultQuerySettings($querySettings);
20
        $query = $this->createQuery();
21
22
        $constraintsAnd[] = $query->equals('uid', $feUserUid);
0 ignored issues
show
Comprehensibility Best Practice introduced by
$constraintsAnd was never initialized. Although not strictly required by PHP, it is generally a good practice to add $constraintsAnd = array(); before regardless.
Loading history...
23
        $constraintsAnd[] = $query->equals('pid', $clientPid);
24
        $query->matching($query->logicalAnd($constraintsAnd));
25
26
        return $query->execute()->count() > 0;
27
    }
28
}
29