schmittjoh / JMSSerializerBundle

Easily serialize, and deserialize data of any complexity (supports XML, JSON, YAML)
http://jmsyst.com/bundles/JMSSerializerBundle
MIT License
1.8k stars 311 forks source link

allow de serialization of enums #919

Closed goetas closed 1 year ago

goetas commented 1 year ago
Q A
Bug fix? yes
New feature? no
Doc updated no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets https://github.com/schmittjoh/serializer/pull/1458 https://github.com/schmittjoh/serializer/pull/1463 https://github.com/schmittjoh/serializer/issues/1461 https://github.com/schmittjoh/serializer/issues/1457 https://github.com/schmittjoh/JMSSerializerBundle/issues/918
License MIT
goetas commented 1 year ago

@CJDennis could you please check if it solves your issue too?

ruudk commented 1 year ago

Just tested it, still getting this problem:

Doctrine\Instantiator\Exception\InvalidArgumentException : The provided class "SocialPlatform" is an enum, and cannot be instantiated
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/Construction/UnserializeObjectConstructor.php:22
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/Construction/DoctrineObjectConstructor.php:73
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/GraphNavigator/DeserializationGraphNavigator.php:189
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/JsonDeserializationVisitor.php:188
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/GraphNavigator/DeserializationGraphNavigator.php:214
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/JsonDeserializationVisitor.php:112
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/GraphNavigator/DeserializationGraphNavigator.php:140
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/JsonDeserializationVisitor.php:188
 /Volumes/CS/www/cosmos/vendor/jms/serializer/src/GraphNavigator/DeserializationGraphNavigator.php:214
ruudk commented 1 year ago

When I apply my fixed PR https://github.com/schmittjoh/serializer/pull/1458/files it does work. So I wonder if you have seen my solution?

goetas commented 1 year ago

ive seen your solution but the typed props driver should not be aware of the enum driver