-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Resolve DateTime value using the Clock #48098
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
Conversation
Hey! Thanks for your PR. You are targeting branch "6.2" but it seems your PR description refers to branch "6.3". Cheers! Carsonbot |
de3a0fc
to
60fe79a
Compare
From php doc:
It looks like we cannot change the reference date when using |
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php
Outdated
Show resolved
Hide resolved
ae845db
to
d2929e7
Compare
dcf32eb
to
c3bc63c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased. Ready for a last review.
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php
Show resolved
Hide resolved
c3bc63c
to
76d71f6
Compare
I tried to use the new |
Now that #48642 is merged, what about leveraging |
Dependency injection is simpler here since this is already a service, and this is easy to test. I don't see the benefit of the global object: that adds a required dependency to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks (small rebase needed)
src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php
Outdated
Show resolved
Hide resolved
9319d95
to
acf7674
Compare
(tests fail) |
acf7674
to
4917528
Compare
Yes sorry, that's fixed. |
Thank you @GromNaN. |
…olver (nicolas-grekas) This PR was merged into the 6.3 branch. Discussion ---------- [HttpKernel] Use TZ from clock service in DateTimeValueResolver | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Fixing #48098 + making tests green by using legit TZ names. Commits ------- 1acf90e [HttpKernel] Use TZ from clock service in DateTimeValueResolver
In order to mock the current time in functional test cases by injecting a
Symfony\Component\Clock\MockClock
asclock
service. This is necessary when aDateTimeInterface
argument is not nullable and we expect the current date time by default.Example when 2 routes are configured on the same controller with an optional parameter.