diff --git a/src/Aggregation/Bucketing/ReverseNestedAggregation.php b/src/Aggregation/Bucketing/ReverseNestedAggregation.php index 66dd0663d2d9df1a3c2fc17c497912c1ac0783c5..c46c7b1e7516b41f4cc1ce5f02c2935cdc689333 100644 --- a/src/Aggregation/Bucketing/ReverseNestedAggregation.php +++ b/src/Aggregation/Bucketing/ReverseNestedAggregation.php @@ -74,10 +74,6 @@ class ReverseNestedAggregation extends AbstractAggregation */ public function getArray() { - if (count($this->getAggregations()) == 0) { - throw new \LogicException("Reverse Nested aggregation `{$this->getName()}` has no aggregations added"); - } - $output = new \stdClass(); if ($this->getPath()) { $output = ['path' => $this->getPath()]; diff --git a/tests/Unit/Aggregation/ReverseNestedAggregationTest.php b/tests/Unit/Aggregation/ReverseNestedAggregationTest.php index a47aaeb208e5caa95a45a9102a3c0d80f58aaba8..2c12f60a621a047e755eaffbc129748b1aa5108c 100644 --- a/tests/Unit/Aggregation/ReverseNestedAggregationTest.php +++ b/tests/Unit/Aggregation/ReverseNestedAggregationTest.php @@ -17,23 +17,6 @@ use ONGR\ElasticsearchDSL\Aggregation\TermsAggregation; class ReverseNestedAggregationTest extends \PHPUnit_Framework_TestCase { - /** - * Test for reverse_nested aggregation toArray() method exception. - * - * @expectedException \LogicException - */ - public function testToArrayException() - { - $aggregation = new ReverseNestedAggregation('test_agg'); - $aggregation->setPath('test_path'); - - $expectedResult = [ - 'reverse_nested' => ['path' => 'test_path'], - ]; - - $this->assertEquals($expectedResult, $aggregation->toArray()); - } - /** * Test for reverse_nested aggregation toArray() method exception. */