From 18e1f105f3d5cb1e213c3f9f2715f6c216a16e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simonas=20=C5=A0erlinskas?= <saimaz@users.noreply.github.com> Date: Thu, 15 Mar 2018 15:47:03 +0100 Subject: [PATCH] fixes #237 - added support for date range keys (#252) (cherry picked from commit 8458ac9) --- src/Aggregation/Bucketing/DateRangeAggregation.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Aggregation/Bucketing/DateRangeAggregation.php b/src/Aggregation/Bucketing/DateRangeAggregation.php index 9b68dcb..d02b3d7 100644 --- a/src/Aggregation/Bucketing/DateRangeAggregation.php +++ b/src/Aggregation/Bucketing/DateRangeAggregation.php @@ -51,7 +51,8 @@ class DateRangeAggregation extends AbstractAggregation foreach ($ranges as $range) { $from = isset($range['from']) ? $range['from'] : null; $to = isset($range['to']) ? $range['to'] : null; - $this->addRange($from, $to); + $key = isset($range['key']) ? $range['key'] : null; + $this->addRange($from, $to, $key); } } @@ -78,12 +79,13 @@ class DateRangeAggregation extends AbstractAggregation * * @throws \LogicException */ - public function addRange($from = null, $to = null) + public function addRange($from = null, $to = null, $key = null) { $range = array_filter( [ 'from' => $from, 'to' => $to, + 'key' => $key, ] ); -- GitLab