Completed
Push — master ( 408932...ce7eb5 )
by Dawid
06:58
created

GenericRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Igni\Storage\Driver;
4
5
use Igni\Storage\EntityManager;
6
use Igni\Storage\Hydration\ObjectHydrator;
7
use Igni\Storage\Mapping\MetaData\EntityMetaData;
8
use Igni\Storage\Repository as RepositoryInterface;
9
10
abstract class GenericRepository implements RepositoryInterface
11
{
12
    /**
13
     * @var Connection
14
     */
15
    protected $connection;
16
    /**
17
     * @var EntityManager
18
     */
19
    protected $entityManager;
20
    /**
21
     * @var ObjectHydrator
22
     */
23
    protected $hydrator;
24
25
    /**
26
     * @var EntityMetaData
27
     */
28
    protected $metaData;
29
30 22
    final public function __construct(EntityManager $entityManager)
31
    {
32 22
        $this->entityManager = $entityManager;
33 22
        $this->metaData = $this->entityManager->getMetaData($this->getEntityClass());
34 22
        $this->hydrator = $this->entityManager->getHydrator($this->getEntityClass());
35 22
        $this->connection = ConnectionManager::getConnection($this->metaData->getConnection());
36 22
    }
37
}
38