Passed
Push — feature/VSVGVQ-7 ( b1c66b...28eb25 )
by steven
02:52
created

AbstractDoctrineRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace VSV\GVQ_API\Question\Repositories;
4
5
use Doctrine\Common\Persistence\ObjectRepository;
6
use Doctrine\ORM\EntityManager;
7
8
abstract class AbstractDoctrineRepository
9
{
10
    /**
11
     * @var EntityManager
12
     */
13
    protected $entityManager;
14
15
    /**
16
     * @var ObjectRepository
17
     */
18
    protected $objectRepository;
19
20
    /**
21
     * @param EntityManager $entityManager
22
     */
23
    public function __construct(EntityManager $entityManager)
24
    {
25
        $this->entityManager = $entityManager;
26
        $this->objectRepository = $this->entityManager->getRepository(
27
            $this->getRepositoryName()
28
        );
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    abstract protected function getRepositoryName(): string;
35
}
36