Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] AddDateTimeNormalizer::CAST_KEY context option#53056

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@norkunas
Copy link
Contributor

@norkunasnorkunas commentedDec 13, 2023
edited
Loading

QA
Branch?7.1
Bug fix?no
New feature?yes
Deprecations?no
IssuesFix#53055
LicenseMIT

This addsDateTimeNormalizer::CAST_KEY context option allowing to cast the formatted result toint orfloat.

@norkunas
Copy link
ContributorAuthor

@mtarld I've updated, is this what you had in mind with deprecation?

@norkunasnorkunasforce-pushed theserializer-timestamp-normalization-cast branch 5 times, most recently from39809e2 toaa8cf48CompareDecember 15, 2023 06:26
@norkunasnorkunasforce-pushed theserializer-timestamp-normalization-cast branch 2 times, most recently fromdc03538 tob3d55dfCompareDecember 20, 2023 06:40
@norkunasnorkunasforce-pushed theserializer-timestamp-normalization-cast branch fromb3d55df tobae7e35CompareDecember 20, 2023 06:45
@norkunas
Copy link
ContributorAuthor

Should I skip those test cases on 32bit systems when value is > PHP_INT_MAX?

@derrabus
Copy link
Member

Should I skip those test cases on 32bit systems when value is > PHP_INT_MAX?

Either that or skip the int cast on those systems.

norkunas reacted with thumbs up emoji

@norkunasnorkunasforce-pushed theserializer-timestamp-normalization-cast branch 5 times, most recently from969e59b to0c85461CompareDecember 20, 2023 11:30
@norkunasnorkunas changed the title[Serializer] Allow to cast certain DateTime formats to int/float[Serializer] AddDateTimeNormalizer::CAST_KEY context optionDec 20, 2023
@norkunas
Copy link
ContributorAuthor

Anybody to review?

Copy link
Contributor

@mtarldmtarld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Code looks good to me. But I'm wondering that maybe we can add a check to make sure that the cast value is consistent with the format? So that it won't be possible to castd/m/Y to anint for example. WDYT?

@norkunas
Copy link
ContributorAuthor

Code looks good to me. But I'm wondering that maybe we can add a check to make sure that the cast value is consistent with the format? So that it won't be possible to castd/m/Y to anint for example. WDYT?

But then we would go back to format guessing, which derrabus wanted to avoid :)

@mtarld
Copy link
Contributor

Oh yeah, I missed that part... Thanks, LGTM then!

norkunas reacted with heart emoji

@fabpotfabpotforce-pushed theserializer-timestamp-normalization-cast branch from0c85461 toe5e925eCompareFebruary 3, 2024 13:24
@fabpot
Copy link
Member

Thank you@norkunas.

norkunas reacted with heart emoji

@fabpotfabpot merged commit6fd41bb intosymfony:7.1Feb 3, 2024
@norkunasnorkunas deleted the serializer-timestamp-normalization-cast branchFebruary 3, 2024 13:25
OskarStark added a commit to symfony/symfony-docs that referenced this pull requestFeb 4, 2024
…ontext option (SzymonKaminski)This PR was merged into the 7.1 branch.Discussion----------[Serializer] Document `DateTimeNormalizer::CAST_KEY` context optionPR documents new context option `CAST_KEY` of `DateTimeNormalizer` that allows to cast objects to integers or floats.Resolves#19485Feature PR:symfony/symfony#53056Commits-------5495c1d [Serializer] Document DateTimeNormalizer::CAST_KEY context option
@fabpotfabpot mentioned this pull requestMay 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@mtarldmtarldmtarld approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

@derrabusderrabusAwaiting requested review from derrabus

+1 more reviewer

@valtzuvaltzuvaltzu left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

7.1

Development

Successfully merging this pull request may close these issues.

[Serializer] DateTimeNormalizer U or U.u format as int/float

6 participants

@norkunas@derrabus@mtarld@fabpot@valtzu@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp