Skip to content

Support nullable date field in HydratorFactory #2753 #2755

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

Merged
merged 7 commits into from
Apr 28, 2025

Conversation

frenchcomp
Copy link
Contributor

Update code generated by the HydratorFactory for date to support nullable datetime field.

Q A
Type bug
BC Break no
Fixed issues #2753

Summary

These PR update only the HydratorFactory class to update the if condition to support nullable field like for other type.
It will update also the clone $return value, because $return can be 'null' and we can not clone null value in PHP.

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

Hello @frenchcomp, thanks for contributing this fix.
Apparently it's breaking an existing test case. Also, the feature needs to be covered by a new non-regression test.

1) Doctrine\ODM\MongoDB\Tests\Functional\DateTest::testDateInstanceValueChangeDoesCauseUpdateIfValueIsTheSame
Failed asserting that an array is not empty.

/home/runner/work/mongodb-odm/mongodb-odm/tests/Doctrine/ODM/MongoDB/Tests/Functional/DateTest.php:102

@GromNaN GromNaN force-pushed the fix/hydrator-date branch from edd531d to 3bffd5c Compare April 28, 2025 07:50
@GromNaN GromNaN added this to the 2.11.1 milestone Apr 28, 2025
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

LGTM after the 2 CS fixes.

@GromNaN GromNaN changed the title Fix "Document HydratorFactory does not support nullable date field" #2753 Support nullable date field in HydratorFactory #2753 Apr 28, 2025
@GromNaN GromNaN merged commit a07b902 into doctrine:2.11.x Apr 28, 2025
20 checks passed
@GromNaN
Copy link
Member

GromNaN commented Apr 28, 2025

Merci Richard!

@frenchcomp
Copy link
Contributor Author

Merci Richard!

De rien, désolé pour les A/R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants