Commit 53c4290d authored by Deividas Petraitis's avatar Deividas Petraitis Committed by Jens Segers

Recursive Convert Dates In Where Clause (#914)

* Recursive Convert Dates In Where Clause

* Fix StyleCI
parent 4e7c4ad1
...@@ -910,9 +910,19 @@ class Builder extends BaseBuilder ...@@ -910,9 +910,19 @@ class Builder extends BaseBuilder
} }
// Convert DateTime values to UTCDateTime. // Convert DateTime values to UTCDateTime.
if (isset($where['value']) and $where['value'] instanceof DateTime) { if (isset($where['value'])) {
if (is_array($where['value'])) {
array_walk_recursive($where['value'], function (&$item, $key) {
if ($item instanceof DateTime) {
$item = new UTCDateTime($item->getTimestamp() * 1000);
}
});
} else {
if ($where['value'] instanceof DateTime) {
$where['value'] = new UTCDateTime($where['value']->getTimestamp() * 1000); $where['value'] = new UTCDateTime($where['value']->getTimestamp() * 1000);
} }
}
}
// The next item in a "chain" of wheres devices the boolean of the // The next item in a "chain" of wheres devices the boolean of the
// first item. So if we see that there are multiple wheres, we will // first item. So if we see that there are multiple wheres, we will
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment