-
-
Notifications
You must be signed in to change notification settings - Fork 356
[Turbo] Fixing support for not using old ClassUtils #1471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Turbo] Fixing support for not using old ClassUtils #1471
Conversation
weaverryan
commented
Feb 7, 2024
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
Issues | Fix #1469 |
License | MIT |
79cb86c
to
536f8b1
Compare
536f8b1
to
4753fc3
Compare
This, indeed, fixes the reported problem |
} | ||
|
||
// @legacy for old versions of Doctrine | ||
if (class_exists(ClassUtils::class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is not imported so it will always return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
if ($entity instanceof LazyObjectInterface) { | ||
$entityClass = get_parent_class($entity); | ||
if (false === $entityClass) { | ||
throw new \LogicException('Parent class missing'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for this exception IMHO, using get_class should be the way if there's no parent
public static function getEntityClass(object $entity): string | ||
{ | ||
if ($entity instanceof LazyObjectInterface) { | ||
$entityClass = get_parent_class($entity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return get_parent_class($entity) ?: \get_class($entity);