Skip to content

Commit

Permalink
refactor: allow only asset or only object indices
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongerig committed Aug 30, 2022
1 parent f8a632b commit 1259291
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/SimpleRESTAdapterBundle/Manager/IndexManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,23 @@ public function findIndexNameByAlias(string $aliasName): string
*/
public function getAllIndexNames(ConfigReader $reader): array
{
$indices = [];
$endpointName = $reader->getName();

return array_merge(
[
$this->getIndexName(self::INDEX_ASSET, $endpointName),
$this->getIndexName(self::INDEX_ASSET_FOLDER, $endpointName),
$this->getIndexName(self::INDEX_OBJECT_FOLDER, $endpointName),
],
array_map(function ($className) use ($endpointName) {
return $this->getIndexName(strtolower($className), $endpointName);
}, $reader->getObjectClassNames())
);
if ($reader->isAssetIndexingEnabled()) {
$indices[] = $this->getIndexName(self::INDEX_ASSET, $endpointName);
$indices[] = $this->getIndexName(self::INDEX_ASSET_FOLDER, $endpointName);
}

if ($reader->isObjectIndexingEnabled()) {
$indices[] = $this->getIndexName(self::INDEX_OBJECT_FOLDER, $endpointName);

foreach ($reader->getObjectClassNames() as $className) {
$indices[] = $this->getIndexName(strtolower($className), $endpointName);
}
}

return $indices;
}

/**
Expand Down

0 comments on commit 1259291

Please sign in to comment.