Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
TASK: Refactor code into common flow
Browse files Browse the repository at this point in the history
As we have the same flow in some more places, we refactor this part to
follow this conventions.
  • Loading branch information
DanielSiepmann committed Dec 29, 2018
1 parent a858d74 commit 564ca15
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Classes/Connection/Elasticsearch/SearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,17 @@ protected function initFacets()
}

$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
);
}
}

Expand Down

0 comments on commit 564ca15

Please sign in to comment.