From 521e226cca0577668702c19aeef9e48aa36f4f1c Mon Sep 17 00:00:00 2001 From: pmishev Date: Wed, 10 Jul 2019 12:17:41 +0100 Subject: [PATCH] Added IndexManagerRegistry::getAll() generator --- Manager/IndexManagerRegistry.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Manager/IndexManagerRegistry.php b/Manager/IndexManagerRegistry.php index 74dfe8d..1098a7e 100644 --- a/Manager/IndexManagerRegistry.php +++ b/Manager/IndexManagerRegistry.php @@ -68,4 +68,17 @@ public function getByEntity(DocumentInterface $entity) return $this->get($indexManagerName); } + + /** + * Get all index manager instances defined + * + * @return \Generator|IndexManager[] + */ + public function getAll() : \Generator + { + $indexManagerNames = $this->metadataCollector->getIndexManagersForDocumentClasses(); + foreach ($indexManagerNames as $indexManagerName) { + yield $this->get($indexManagerName); + } + } }