From f3290b836f7dd5ac5418f93bea770bd61e69e55f Mon Sep 17 00:00:00 2001 From: Martynas Sudintas <martynas.sudintas@nfq.lt> Date: Wed, 28 Jan 2015 16:30:17 +0200 Subject: [PATCH] changed NamedBuilderBag::all to filter by types --- Aggregation/AbstractAggregation.php | 2 +- NamedBuilderBag.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Aggregation/AbstractAggregation.php b/Aggregation/AbstractAggregation.php index 7ff124a..110a4a5 100644 --- a/Aggregation/AbstractAggregation.php +++ b/Aggregation/AbstractAggregation.php @@ -134,7 +134,7 @@ abstract class AbstractAggregation implements NamedBuilderInterface protected function collectNestedAggregations() { $result = []; - foreach ($this->aggregations->all() as $aggregation) { + foreach ($this->getAggregations() as $aggregation) { $result = array_merge($result, $aggregation->toArray()); } diff --git a/NamedBuilderBag.php b/NamedBuilderBag.php index 2d90543..e808d5d 100644 --- a/NamedBuilderBag.php +++ b/NamedBuilderBag.php @@ -96,18 +96,18 @@ class NamedBuilderBag /** * Returns all builders contained. * - * @param string|null $name Builder name. + * @param string|null $type Builder type. * * @return NamedBuilderInterface[] */ - public function all($name = null) + public function all($type = null) { return array_filter( $this->bag, - function ($builder) use ($name) { + function ($builder) use ($type) { /** @var NamedBuilderInterface $builder */ - return $name === null || $builder->getName() == $name; + return $type === null || $builder->getType() == $type; } ); } -- GitLab