| Conditions | 6 |
| Paths | 24 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public static function combine(ClassMappingInterface $parent, ClassMappingInterface $child): ClassMappingInterface |
||
| 15 | { |
||
| 16 | $target = new ClassMapping(); |
||
| 17 | $target->setEntityName($child->getEntityName()); |
||
| 18 | $defaultView = ClassMappingView::merge($parent->getDefaultView(), $child->getDefaultView()); |
||
| 19 | $target->setDefaultView($defaultView); |
||
| 20 | foreach ($parent->getViews() as $name => $view) { |
||
| 21 | $target->setView($name, ClassMappingView::merge($target->requestView($name), $view)); |
||
| 22 | } |
||
| 23 | foreach ($child->getViews() as $name => $view) { |
||
| 24 | $target->setView($name, ClassMappingView::merge($target->requestView($name), $view)); |
||
| 25 | } |
||
| 26 | $ignoredProperties = $child->getIgnoredParentProperties() ?? []; |
||
| 27 | foreach ($parent->getProperties() as $name => $property) { |
||
| 28 | if (!in_array($name, $ignoredProperties)) { |
||
| 29 | $target->setProperty($name, $property); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | foreach ($child->getProperties() as $name => $property) { |
||
| 33 | $target->setProperty($name, PropertyMapping::merge($target->requestProperty($name), $property)); |
||
| 34 | } |
||
| 35 | return $target; |
||
| 36 | } |
||
| 38 |