EntityRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findByDomainId() 0 4 1
A domainIdExists() 0 9 1
1
<?php
2
3
namespace Nord\Lumen\Core\Infrastructure;
4
5
use Doctrine\ORM\EntityRepository as BaseRepository;
6
use Nord\Lumen\Core\Contracts\Entity;
7
8
class EntityRepository extends BaseRepository
9
{
10
    /**
11
     * @param string $domainId
12
     *
13
     * @return Entity|null|object
14
     */
15
    public function findByDomainId($domainId)
16
    {
17
        return $this->findOneBy(['domainId' => $domainId]);
18
    }
19
20
    /**
21
     * @param $domainId
22
     *
23
     * @return int
24
     */
25
    public function domainIdExists($domainId)
26
    {
27
        return (int) $this->createQueryBuilder('t')
28
            ->select('COUNT(t.domainId)')
29
            ->where('t.domainId = :domainId')
30
            ->setParameter('domainId', $domainId)
31
            ->getQuery()
32
            ->getSingleScalarResult();
33
    }
34
}
35