Skip to content

Commit

Permalink
Support for trait mapping files
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfoot90 committed Jan 6, 2022
1 parent 9f22673 commit 45583e2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Doctrine/Persistence/Mapping/RuntimeReflectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,19 @@ public function __construct()
*/
public function getParentClasses($class)
{
if (! class_exists($class)) {
if (! (class_exists($class) || trait_exists($class)) ) {
throw MappingException::nonExistingClass($class);
}

$parents = class_parents($class);
$parents = class_parents($class) + class_uses($class);

assert($parents !== false);

// Support traits from parent classes
foreach ($parents as $parentClass) {
$parents = array_merge($parents, $this->getParentClasses($parentClass));
}

return $parents;
}

Expand Down

0 comments on commit 45583e2

Please sign in to comment.