From 6d5c493fa2fcbcb8964e4c8d00971925ff04c675 Mon Sep 17 00:00:00 2001
From: Aivaras Gotovskis <aivaras.gotovskis@ongr.io>
Date: Wed, 8 Jul 2015 14:06:04 +0300
Subject: [PATCH] Add field argument to aggregation constructor.

---
 src/Aggregation/AbstractAggregation.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/Aggregation/AbstractAggregation.php b/src/Aggregation/AbstractAggregation.php
index 19c5a0f..e72c437 100644
--- a/src/Aggregation/AbstractAggregation.php
+++ b/src/Aggregation/AbstractAggregation.php
@@ -60,10 +60,14 @@ abstract class AbstractAggregation implements NamedBuilderInterface
      * Inner aggregations container init.
      *
      * @param string $name
+     * @param string $field
      */
-    public function __construct($name)
+    public function __construct($name, $field = null)
     {
         $this->name = $name;
+        if ($field !== null) {
+            $this->setField($field);
+        }
         $this->aggregations = new NamedBuilderBag();
     }
 
-- 
GitLab