Total Complexity | 5 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 50% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
8 | abstract class GenericHydrator implements ObjectHydrator |
||
9 | { |
||
10 | protected $entityManager; |
||
11 | protected $metaData; |
||
12 | protected $mode; |
||
13 | |||
14 | 21 | public function __construct(EntityManager $entityManager, string $mode = HydrationMode::BY_REFERENCE) |
|
15 | { |
||
16 | 21 | $this->mode = $mode; |
|
17 | 21 | $this->entityManager = $entityManager; |
|
18 | 21 | $this->metaData = $entityManager->getMetaData($this->getEntityClass()); |
|
19 | 21 | } |
|
20 | |||
21 | public function setMode(string $mode): void |
||
22 | { |
||
23 | $this->mode = $mode; |
||
24 | } |
||
25 | |||
26 | public function getMode(): string |
||
27 | { |
||
28 | return $this->mode; |
||
29 | } |
||
30 | |||
31 | 13 | public function getEntityManager(): EntityManager |
|
34 | } |
||
35 | |||
36 | public function getMetaData(): EntityMetaData |
||
39 | } |
||
40 | |||
41 | abstract public static function getEntityClass(): string; |
||
42 | } |
||
43 |