Skip to content
Snippets Groups Projects
Commit 38f26df4 authored by Aivaras Gotovskis's avatar Aivaras Gotovskis
Browse files

Add format and ranges arguments to DateRangeAggregation aggregation.

parent 1a072981
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,24 @@ class DateRangeAggregation extends AbstractAggregation
return $this->format;
}
/**
* @param string $name
* @param string $field
* @param string $format
* @param array $ranges
*/
public function __construct($name, $field = null, $format = null, array $ranges = [])
{
parent::__construct($name, $field);
$this->setFormat($format);
foreach ($ranges as $range) {
$from = isset($range['from']) ? $range['from'] : null;
$to = isset($range['to']) ? $range['to'] : null;
$this->addRange($from, $to);
}
}
/**
* @param string $format
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment