1 | <?php |
||
21 | final class NullableMapping implements MappingInterface |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @var MappingInterface |
||
26 | */ |
||
27 | private $innerMapping; |
||
28 | |||
29 | /** |
||
30 | * @var Column|null |
||
31 | */ |
||
32 | private $dbalColumn; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $origin; |
||
38 | |||
39 | 16 | public function __construct( |
|
48 | |||
49 | 1 | public function getDBALColumn(): ?Column |
|
53 | |||
54 | 1 | public function getInnerMapping(): MappingInterface |
|
58 | |||
59 | 1 | public function describeOrigin(): string |
|
63 | |||
64 | 3 | public function collectDBALColumns(): array |
|
84 | |||
85 | 9 | public function getDeterminatorColumnName(): ?string |
|
96 | |||
97 | 4 | public function resolveValue( |
|
131 | |||
132 | 4 | public function revertValue( |
|
133 | HydrationContextInterface $context, |
||
134 | $valueFromEntityField |
||
135 | ): array { |
||
136 | /** @var array<scalar> $data */ |
||
137 | 4 | $data = array(); |
|
138 | |||
139 | /** @var string|null $columnName */ |
||
140 | 4 | $columnName = $this->getDeterminatorColumnName(); |
|
141 | |||
142 | 4 | if (!is_null($valueFromEntityField)) { |
|
143 | 3 | $data = $this->innerMapping->revertValue( |
|
144 | 3 | $context, |
|
145 | 3 | $valueFromEntityField |
|
146 | ); |
||
147 | |||
148 | 3 | if (!empty($columnName) && !array_key_exists($columnName, $data)) { |
|
149 | 3 | $data[$columnName] = true; |
|
150 | } |
||
151 | |||
152 | 1 | } elseif (!empty($columnName)) { |
|
153 | 1 | $data[$columnName] = false; |
|
154 | } |
||
155 | |||
156 | 4 | return $data; |
|
157 | } |
||
158 | |||
159 | 1 | public function assertValue( |
|
165 | |||
166 | 1 | public function wakeUpMapping(ContainerInterface $container): void |
|
170 | |||
171 | } |
||
172 |