Skip to content

Commit

Permalink
bug #1477 [Turbo] simplify returning entity class name (jrushlow)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x branch.

Discussion
----------

[Turbo] simplify returning entity class name

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes/no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | Fix #
| License       | MIT

credit goes to nicolas, but alternate way to return the class name

Commits
-------

cded391 [Turbo] simplify returning entity class name
  • Loading branch information
weaverryan committed Feb 9, 2024
2 parents 9e086b1 + cded391 commit 6b6c57c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Turbo/src/Doctrine/ClassUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@ final class ClassUtil
public static function getEntityClass(object $entity): string
{
if ($entity instanceof LazyObjectInterface) {
$entityClass = get_parent_class($entity);
if (false === $entityClass) {
throw new \LogicException('Parent class missing');
}

return $entityClass;
return get_parent_class($entity) ?: $entity::class;
}

// @legacy for old versions of Doctrine
Expand Down

0 comments on commit 6b6c57c

Please sign in to comment.