Skip to content

Commit f602a88

Browse files
committed
Fix Doctrine Proxy resolution
1 parent fed00e2 commit f602a88

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Turbo/src/Doctrine/ClassUtil.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\UX\Turbo\Doctrine;
1313

14-
use Doctrine\Common\Util\ClassUtils as LegacyClassUtils;
1514
use Symfony\Component\VarExporter\LazyObjectInterface;
1615

1716
/**
@@ -24,13 +23,13 @@ final class ClassUtil
2423
*/
2524
public static function getEntityClass(object $entity): string
2625
{
27-
if ($entity instanceof LazyObjectInterface) {
28-
return get_parent_class($entity) ?: $entity::class;
26+
// Doctrine proxies (old versions)
27+
if (str_contains($entity::class, 'Proxies\\__CG__')) {
28+
return get_parent_class($entity);
2929
}
3030

31-
// @legacy for old versions of Doctrine
32-
if (class_exists(LegacyClassUtils::class)) {
33-
return LegacyClassUtils::getClass($entity);
31+
if ($entity instanceof LazyObjectInterface) {
32+
return get_parent_class($entity) ?: $entity::class;
3433
}
3534

3635
return $entity::class;

0 commit comments

Comments
 (0)