-
-
Notifications
You must be signed in to change notification settings - Fork 888
fix: Handle Symfony serializer datetime_format context for date formatting
#2551
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
base: 5.x
Are you sure you want to change the base?
fix: Handle Symfony serializer datetime_format context for date formatting
#2551
Conversation
datetime_format context for date formattingdatetime_format context for date formatting
d5b6deb to
14924a4
Compare
14924a4 to
29aab02
Compare
|
Thanks for opening a PR! I think we should expand the Then the |
Add values from the Symfony Context attribute to property context, for use in property describers.
eed3d6e to
982ffa2
Compare
|
Thanks for your feedback, that does seem like a much better solution than what I originally went with! As far as I could tell, there's no cases yet where the I've kept the processing for checking if the The alternative I considered which would have required less refactoring was to store to the I've pushed a new commit with these changes to help keep track of my changes, but can squash everything down into a single commit once you're happy with everything before merging! |
|
This PR has been marked as stale because it has not had any activity for 60 days. Remove stale label or comment to prevent this from being closed in 60 days. |
|
I'm not sure if passing the context data into a That means we cannot easily use the same references Symfony does internally. $context['symfony_context']['datetime_format']vs $context['datetime_format']I think the second variant makes it theoretically easier for users extending the bundle can have the same expectations as the serializer context. |
|
I personally also want to still refactor these This is not related to your PR though and more of a personal 'I want to fix this in the future', but more logic in these classes won't make it easier to refactor these. 😢 |
Description
Symfony serializer supports a
Contextattribute which can provide details for how to normalize a property. Specifically, adatetime_formatkey can be provided to specify how to format aDateTimefield. This PR handles adatetime_formatvalue ofY-m-dand sets theformattodate, rather than the current incorrect value ofdate-time.I don't believe there are any issues this PR will close, though this was brought up in a comment at #2145 (comment)
What type of PR is this? (check all applicable)
Checklist
docs/)CHANGELOG.md)Uncertainties
SymfonyConstraintAnnotationReader), and making this a more genericSymfonyAnnotationReaderclass. The class was documented as@internalso I don't believe this would be a breaking change. If you'd rather I go down a different route, please give me some pointers of where/how you'd like this implemented.