Skip to content

Commit

Permalink
ADD support for enum-casting of type field
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoguido committed Apr 6, 2023
1 parent 9aa3816 commit b972387
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/HasChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ public function classFromAlias($aliasOrClass): string
{
$childTypes = $this->getChildTypes();

// Handling Enum casting for `type` column
if ($aliasOrClass instanceof \UnitEnum) {
$aliasOrClass = $aliasOrClass->value;
}

if (isset($childTypes[$aliasOrClass])) {
return $childTypes[$aliasOrClass];
}
Expand Down

0 comments on commit b972387

Please sign in to comment.