Skip to content
Snippets Groups Projects
Commit f3290b83 authored by Martynas Sudintas's avatar Martynas Sudintas
Browse files

changed NamedBuilderBag::all to filter by types

parent f40fd130
No related branches found
No related tags found
No related merge requests found
......@@ -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());
}
......
......@@ -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;
}
);
}
......
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