From f1092ba46bee0cd9444209c6e34a2fb74cfbc98e Mon Sep 17 00:00:00 2001 From: Camille Lafitte Date: Mon, 30 Aug 2021 11:03:08 +0200 Subject: [PATCH] A workaround to provide all properties on final class * Search parent class and apply children element to final model Note : Should be managed by subTypes properties but actual code don't allow to propagate other object/property --- src/Routes.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Routes.php b/src/Routes.php index db3c012c..59832e4e 100644 --- a/src/Routes.php +++ b/src/Routes.php @@ -743,6 +743,18 @@ protected static function getTypeAndModel(ReflectionClass $class, array $scope, $children[$name][$dataName]['required'] = isset($required[$name]); } } + + if ($parentClassName = get_parent_class($className)) { + $parentModel = static::getTypeAndModel(new ReflectionClass($parentClassName), $scope, $prefix, $rules); + //If class parent has children add them to current class + if (!empty($parentModel[1])) { + $children = array_merge_recursive( + $parentModel[1], + $children + ); + } + } + static::$models[$prefix.$className] = array($className, $children, $prefix.$className); return static::$models[$prefix.$className]; }