Skip to content
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

Narrow responsibilities in datetime related types #6017

Merged
merged 1 commit into from
May 11, 2023

Conversation

phansys
Copy link
Contributor

@phansys phansys commented Apr 17, 2023

Q A
Type improvement
Fixed issues n/a

Summary

  • Deprecated passing other type than DateTime|null to DateType, TimeType, DateTimeType, DateTimeTzType and VarDateTimeType;
  • new DateTime() and new DateTimeImmutable() are used as replacement to date_create() and date_create_immutable() procedural functions.

@phansys phansys force-pushed the datetime_types branch 4 times, most recently from 8207344 to fef8c3c Compare April 17, 2023 19:48
@phansys phansys marked this pull request as ready for review April 17, 2023 20:02
@phansys phansys force-pushed the datetime_types branch 12 times, most recently from f5e3389 to ebe6512 Compare April 18, 2023 12:53
docs/en/reference/types.rst Outdated Show resolved Hide resolved
docs/en/reference/types.rst Outdated Show resolved Hide resolved
@greg0ire
Copy link
Member

greg0ire commented Apr 18, 2023

I think you are doing this because in case a user wants to save the timezone but shoots themselves in the foot by picking the wrong type, is that it?

@phansys
Copy link
Contributor Author

phansys commented Apr 18, 2023

I think you are doing this because in case a user wants to save the timezone but shoot themselves in the foot by picking the wrong type, is that it?

Yes. That's the main goal IMO.
Sorry, I answered by inertia based on my other PRs.
In this case, the goal is to avoid false expectations when using \DateTimeImmutable in types that are intended for \DateTime.

@phansys phansys force-pushed the datetime_types branch 2 times, most recently from 14b3b34 to 2d57b7a Compare April 19, 2023 00:40
@phansys phansys requested a review from greg0ire April 19, 2023 00:47
greg0ire
greg0ire previously approved these changes Apr 19, 2023
@greg0ire greg0ire requested review from SenseException and removed request for andrew-demb April 19, 2023 05:29
SenseException
SenseException previously approved these changes Apr 19, 2023
src/Types/DateTimeImmutableType.php Outdated Show resolved Hide resolved
src/Types/DateTimeType.php Outdated Show resolved Hide resolved
src/Types/VarDateTimeImmutableType.php Outdated Show resolved Hide resolved
src/Types/VarDateTimeType.php Outdated Show resolved Hide resolved
@derrabus derrabus added this to the 3.7.0 milestone May 8, 2023
@phansys phansys dismissed stale reviews from SenseException and greg0ire via 2decc32 May 8, 2023 10:13
src/Types/DateTimeType.php Show resolved Hide resolved
@greg0ire greg0ire merged commit 2a6860c into doctrine:3.7.x May 11, 2023
@greg0ire
Copy link
Member

Thanks @phansys !

@phansys phansys deleted the datetime_types branch May 11, 2023 18:19
BacLuc added a commit to BacLuc/ecamp3 that referenced this pull request Dec 24, 2023
Passing an instance of DateTimeImmutable is deprecated, use Doctrine\DBAL\Types\DateTimeImmutableType::convertToDatabaseValue() instead. (DateTimeType.php:51 called by UTCDateTimeType.php:41, doctrine/dbal#6017, package doctrine/dbal)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants