Total Complexity | 4 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | #[\Attribute(\Attribute::TARGET_PROPERTY), NamedArgumentConstructor] |
||
16 | final class Embedded extends Relation |
||
17 | { |
||
18 | protected const TYPE = 'embedded'; |
||
19 | protected ?string $embeddedPrefix = null; |
||
20 | |||
21 | /** |
||
22 | * @param non-empty-string $target Entity to embed. |
||
|
|||
23 | * @param 'eager'|'lazy' $load Relation load approach. |
||
24 | * @param string|null $prefix Prefix for embedded entity columns. |
||
25 | */ |
||
26 | 72 | public function __construct( |
|
27 | string $target, |
||
28 | #[ExpectedValues(values: ['lazy', 'eager'])] |
||
29 | string $load = 'eager', |
||
30 | ?string $prefix = null, |
||
31 | ) { |
||
32 | 72 | $this->embeddedPrefix = $prefix; |
|
33 | |||
34 | 72 | parent::__construct($target, $load); |
|
35 | 72 | } |
|
36 | |||
37 | 72 | public function getInverse(): ?Inverse |
|
38 | { |
||
39 | 72 | return null; |
|
40 | } |
||
41 | |||
42 | 72 | public function getPrefix(): ?string |
|
43 | { |
||
44 | 72 | return $this->embeddedPrefix; |
|
45 | } |
||
46 | |||
47 | 72 | public function setPrefix(string $prefix): self |
|
52 | } |
||
53 | } |
||
54 |