Total Complexity | 6 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | abstract class Relation implements RelationInterface |
||
16 | { |
||
17 | // relation type |
||
18 | protected const TYPE = ''; |
||
19 | |||
20 | /** |
||
21 | * @Required() |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $target; |
||
25 | |||
26 | /** |
||
27 | * @Enum({"eager", "lazy", "promise"} |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $load; |
||
31 | |||
32 | /** |
||
33 | * @param array $values |
||
34 | */ |
||
35 | public function __construct(array $values) |
||
36 | { |
||
37 | foreach ($values as $key => $value) { |
||
38 | if ($key == "fetch") { |
||
39 | $key = "load"; |
||
40 | } |
||
41 | |||
42 | $this->$key = $value; |
||
43 | } |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @return string |
||
48 | */ |
||
49 | public function getType(): string |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return string|null |
||
56 | */ |
||
57 | public function getTarget(): ?string |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return array |
||
64 | */ |
||
65 | public function getOptions(): array |
||
71 | } |
||
72 | } |