EntityManagerTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 3
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createQueryBuilder() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\Doctrine\Adapter\ORM;
13
14
use Doctrine\ORM\EntityManager;
15
use Doctrine\ORM\EntityRepository;
16
use Doctrine\ORM\QueryBuilder;
17
18
trait EntityManagerTrait
19
{
20
    /**
21
     * Creates a new QueryBuilder instance that is prepopulated for this entity name.
22
     *
23
     * @return EntityManager|QueryBuilder
24
     */
25
    final protected function createQueryBuilder(string $alias, string $indexBy = null)
26
    {
27
        return $this->getRepository()
28
            ->createQueryBuilder($alias, $indexBy)
29
        ;
30
    }
31
32
    /**
33
     * Returns the related Object Repository.
34
     *
35
     * @return EntityRepository
36
     */
37
    abstract protected function getRepository();
38
}
39