-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Convert whereBetween values to UTCDateTime #953
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
Added a protected method (dateTimeConvertion) to convert DateTime objects to MongoDB\BSON\UTCDateTime and added a verification for DateTime objects in $where['values'] array to ensure that all DateTime values will be properly converted to MongoDB\BSON\UTCDateTime.
Added a protected method (dateTimeConvertion) to convert DateTime objects to MongoDB\BSON\UTCDateTime and added a verification for DateTime objects in $where['values'] array to ensure that all DateTime values will be properly converted to MongoDB\BSON\UTCDateTime.
Assert if a MongoDB\BSON\UTCDateTime is created if you set a DateTime object as whereBetween parameter
CHANGE white space
protected function dateTimeConvertion($value) | ||
{ | ||
if ($value instanceof DateTime) { | ||
return new UTCDateTime($value->getTimestamp() * 1000); |
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.
Why UTCDateTime instead UTCDatetime?
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.
According PHP documentation, the class name is UTCDateTime
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.
Isn't the if conditional check redundant? You are already checking if the value is an instance of DateTime before calling the dateTimeConversion function.
This issue isn't fixed yet ? |
It was merged at moloquent/moloquent, I don't know why nobody has merged this PR here! |
already fixed by #1328 |
Then this PR should be closed. |
Added a protected method (dateTimeConvertion) to convert DateTime objects to MongoDB\BSON\UTCDateTime and added a verification for DateTime objects in $where['values'] array to ensure that all DateTime values will be properly converted to MongoDB\BSON\UTCDateTime.