-
-
Notifications
You must be signed in to change notification settings - Fork 372
Closed
Labels
Description
Using v2.3 of the Live Component.
I'm using a DTO as a data class with a form in a live component. It's working OK with scalar values in the DTO.
However, when I try and use Money/Money
object as one of the form data properties, it borks with:
ErrorException:
Warning: Undefined array key 0
at vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php:883
at Doctrine\ORM\Mapping\ClassMetadataInfo->getIdentifierValues(object(Money))
(vendor/symfony/ux-live-component/src/Normalizer/DoctrineObjectNormalizer.php:44)
at Symfony\UX\LiveComponent\Normalizer\DoctrineObjectNormalizer->normalize(object(Money), 'json', array('live-component' => true, 'cache_key' => '87beb01efbb89bc8a83bf4e8e91ba0dc', 'circular_reference_limit_counters' => array('0000000000000d700000000000000000' => 1)))
(vendor/symfony/serializer/Serializer.php:161)
at Symfony\Component\Serializer\Serializer->normalize(object(Money), 'json', array('live-component' => true, 'cache_key' => '87beb01efbb89bc8a83bf4e8e91ba0dc', 'circular_reference_limit_counters' => array('0000000000000d700000000000000000' => 1)))
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:216)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->normalize(object(DefaultPriceData), 'json', array('live-component' => true, 'cache_key' => '87beb01efbb89bc8a83bf4e8e91ba0dc', 'circular_reference_limit_counters' => array('0000000000000d700000000000000000' => 1)))
(vendor/symfony/serializer/Serializer.php:161)
at Symfony\Component\Serializer\Serializer->normalize(object(DefaultPriceData), 'json', array('live-component' => true))
(vendor/symfony/ux-live-component/src/LiveComponentHydrator.php:87)file=vendor/symfony/serializer/Serializer.php&line=161#line161)-> normalize (line 161)
Looking at the DoctrineObjectNormalizer
I see it is given a priority of 100, making it kick in way before my custom Money normalizer which is already registered with the serializer.
Why is the DoctrineObjectNormalizer
given such a high priority, and why is it trying to normalize my non-Doctrine object?
What would be the best way to get around this?
Thank you.