Skip to content

Commit 45583e2

Browse files
committed
Support for trait mapping files
1 parent 9f22673 commit 45583e2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/Doctrine/Persistence/Mapping/RuntimeReflectionService.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,19 @@ public function __construct()
3535
*/
3636
public function getParentClasses($class)
3737
{
38-
if (! class_exists($class)) {
38+
if (! (class_exists($class) || trait_exists($class)) ) {
3939
throw MappingException::nonExistingClass($class);
4040
}
4141

42-
$parents = class_parents($class);
42+
$parents = class_parents($class) + class_uses($class);
4343

4444
assert($parents !== false);
4545

46+
// Support traits from parent classes
47+
foreach ($parents as $parentClass) {
48+
$parents = array_merge($parents, $this->getParentClasses($parentClass));
49+
}
50+
4651
return $parents;
4752
}
4853

0 commit comments

Comments
 (0)