Skip to content
Snippets Groups Projects
Commit 72c2fc55 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas Committed by GitHub
Browse files

Merge pull request #156 from ansata-biz/fix-nested-and-reversenested-aggregations

Fixes nested and reverse nested aggregation requirements
parents b71b088e 7e3fc57c
No related branches found
No related tags found
No related merge requests found
...@@ -71,6 +71,10 @@ class NestedAggregation extends AbstractAggregation ...@@ -71,6 +71,10 @@ class NestedAggregation extends AbstractAggregation
*/ */
public function getArray() public function getArray()
{ {
if (count($this->getAggregations()) == 0) {
throw new \LogicException("Nested aggregation `{$this->getName()}` has no aggregations added");
}
return ['path' => $this->getPath()]; return ['path' => $this->getPath()];
} }
} }
...@@ -71,10 +71,6 @@ class ReverseNestedAggregation extends AbstractAggregation ...@@ -71,10 +71,6 @@ class ReverseNestedAggregation extends AbstractAggregation
*/ */
public function getArray() public function getArray()
{ {
if (count($this->getAggregations()) == 0) {
throw new \LogicException("Reverse Nested aggregation `{$this->getName()}` has no aggregations added");
}
$output = new \stdClass(); $output = new \stdClass();
if ($this->getPath()) { if ($this->getPath()) {
$output = ['path' => $this->getPath()]; $output = ['path' => $this->getPath()];
......
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