TASK: Refactor code into common flow

As we have the same flow in some more places, we refactor this part to
follow this conventions.
This commit is contained in:
Daniel Siepmann 2018-12-29 18:07:25 +01:00
parent a858d748ee
commit 564ca1511c
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -121,14 +121,17 @@ class SearchResult implements SearchResultInterface
}
$this->facets = [];
if ($this->result->hasAggregations()) {
foreach ($this->result->getAggregations() as $aggregationName => $aggregation) {
$this->facets[$aggregationName] = $this->objectManager->get(
Facet::class,
$aggregationName,
$aggregation
);
}
if ($this->result->hasAggregations() === false) {
return;
}
foreach ($this->result->getAggregations() as $aggregationName => $aggregation) {
$this->facets[$aggregationName] = $this->objectManager->get(
Facet::class,
$aggregationName,
$aggregation
);
}
}