-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Can't get to work with DateTime denormalization #85
Comments
Did you check the FAQ? https://github.com/dunglas/doctrine-json-odm#faq |
Yes, that's what I meant with documentation. And the 3 normalizers, what are under the FAQ are registered. |
Okay. So if you're using xdebug you should see if the datetime normalizer is called, right? |
Yes, and that's the problem that it's not called but the DateTimeNormalizer is one of the 3 normalizers and I can't figure it out why. |
I've taken a look at it again and I will try to create tomorrow an example SF app for this. |
Ok, I know what the problem is and it's connected to my previous comment. I've found no update.MD file so I thought the old serialized data should be comatible with the new. I did a serialization and that is the result:
instead of the result in the DB with version 0.1.3
I think this should be documented somewhere. |
Or am I doing something wrong here @Toflar ? |
You can always use the compiler pass to add all the normalizers & encoders:
|
@dunglas i changed the Symfony SerializerPass to work with your code, this will prevent these types of issues:
|
For me it was only 20 entries in the database, I just changed it with a script, but I think it would be good to mentions this difference. |
I've used previously the
0.1.3
version and wanted to update it to v1. I've done the setup according to the documentation, just that 3 normalizer, but somehow my dateTime is not deserialized.I've checked it with xdebug and all 3 normalizers are registered and they have the right order.
My json string:
EventSchedule
Error message:
Failed to denormalize attribute "endDate" value for class "App\Entity\EventSchedule": Expected argument of type "DateTimeImmutable", "string" given at property path "endDate"
I would highly appreciate any help.
I have ApiPlatform installed, but in this request, it's not used. I tried just calling the service in the controller and passing the string to the deserialize event.
The text was updated successfully, but these errors were encountered: