-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Description
Symfony version(s) affected
6.4.22
Description
When serializing Doctrine ORM proxy, \Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::getReadInfo
is retuning property info because it see magic-methods
if ($allowMagicGet && $reflClass->hasMethod('__get') && (($r = $reflClass->getMethod('__get'))->getModifiers() & $this->methodReflectionFlags)) {
return new PropertyReadInfo(PropertyReadInfo::TYPE_PROPERTY, $property, PropertyReadInfo::VISIBILITY_PUBLIC, false, $r->returnsReference());
}
and getting following error:
Can't get a way to read the property "deletedAt" in class "Proxies\__CG__\App\Entity\Supplier".
there is away to control it from outside of ReflectionExtractor
by passing enable_getter_setter_extraction
or enable_magic_methods_extraction
but \Symfony\Component\Serializer\Normalizer\ObjectNormalizer::isAllowedAttribute
is not doing it.
How to reproduce
$supplier = $this->entityManager->getReference(Supplier::class, 1419);
$this->normalizer->normalize($supplier);
Possible Solution
- pass $content from
isAllowedAttribute
to property-info and allow control from outside it's behavior
Additional Context
- if I disable enable_lazy_ghost_objects,
\Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::getReadInfo
returns null, which later again enters same extractor and throws\Symfony\Component\PropertyAccess\Exception\AccessException