| Total Complexity | 8 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 11 | class RelationBlock extends ArrayBlock |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @see SchemaInterface |
||
| 15 | */ |
||
| 16 | private const RELATION_SCHEMA_KEYS = [ |
||
| 17 | 'MORPH_KEY', |
||
| 18 | 'CASCADE', |
||
| 19 | 'NULLABLE', |
||
| 20 | 'OUTER_KEY', |
||
| 21 | 'INNER_KEY', |
||
| 22 | 'INVERSION', |
||
| 23 | 'WHERE', |
||
| 24 | 'ORDER_BY', |
||
| 25 | 'THROUGH_INNER_KEY', |
||
| 26 | 'THROUGH_OUTER_KEY', |
||
| 27 | 'THROUGH_ENTITY', |
||
| 28 | 'THROUGH_WHERE', |
||
| 29 | // Cycle ORM v1 deprecations: |
||
| 30 | 'THOUGH_INNER_KEY', |
||
| 31 | 'THOUGH_OUTER_KEY', |
||
| 32 | 'THOUGH_ENTITY', |
||
| 33 | 'THOUGH_WHERE', |
||
| 34 | ]; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param int|string $key |
||
| 38 | * @param mixed $value |
||
| 39 | */ |
||
| 40 | protected function wrapItem($key, $value): ArrayItem |
||
| 41 | { |
||
| 42 | $item = parent::wrapItem($key, $value); |
||
| 43 | if ($key === Relation::SCHEMA && is_array($value)) { |
||
| 44 | $item->setValue(new self($value, $this->getReplaceKeys()), false); |
||
| 45 | } |
||
| 46 | return $item; |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return array<int, string> |
||
| 51 | */ |
||
| 52 | private function getReplaceKeys(): array |
||
| 67 | } |
||
| 68 | } |
||
| 69 |