-
-
Notifications
You must be signed in to change notification settings - Fork 510
Add millisecond support for Date mapping type #1028
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
@gerryvdm is Travis failure related to your changes? Also I think adding a test for this PR would be great :) |
@malarzm Not sure, the error seems a bit exotic. Will add a test! |
This should also fix #901. |
It's a bit blind guess but there's field mapped as date and as not saved in https://github.com/doctrine/mongodb-odm/blob/master/tests/Documents/File.php#L29 which is referenced by https://github.com/doctrine/mongodb-odm/blob/master/tests/Documents/Profile.php#L21 which should be the class with hydration problem - maybe that's it? |
I think the problem is related to timezones. Will need to have a further look. |
While DateTime::setTimestamp() allows negative timestamps, DateTime::createFromFormat('U') does not.
Well that was harder than I imagined, but I think the problem is solved. Needed some workaround for allowing pre-unix era timestamps... |
👍 |
ping @jmikola. Any chance to review? |
Fixes #1061 |
I hadn’t seen your PR and I created one as well: #1063. The differences:
In the end, we could merge those two PRs, but I feel mine is more complete. |
Holding on merge in favor of #1063 |
Both MongoDB and the PHP DateTime class support milliseconds, but currently this information is lost in the date mapping type.
This patch will transfer the millisecond information between PHP and MongoDB.