OrmRepositoryTrait::createQueryBuilder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Common\Doctrine\Orm;
6
7
use Doctrine\ORM\EntityManagerInterface;
8
use Doctrine\ORM\QueryBuilder;
9
10
/**
11
 * @codeCoverageIgnore
12
 */
13
trait OrmRepositoryTrait
14
{
15
    /**
16
     * @var EntityManagerInterface
17
     */
18
    private $em;
19
20
    /**
21
     * @var string
22
     */
23
    private $className;
24
25
    private function createQueryBuilder(string $alias): QueryBuilder
26
    {
27
        return $this->em
28
            ->createQueryBuilder()
29
            ->select($alias)
30
            ->from($this->className, $alias)
31
        ;
32
    }
33
}
34