Skip to content

Commit

Permalink
Merge pull request #110 from marcoguido/main
Browse files Browse the repository at this point in the history
ADD support for enum-casting of `type` field
  • Loading branch information
driftingly authored May 5, 2023
2 parents 9aa3816 + b972387 commit 0651c4b
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 0651c4b

Please sign in to comment.