/** * {@inheritdoc} */ public function reindex($class = null, $offset = null, $limit = null) { if (null === $class) { $this->clearAllSearchIndexes(); $entityNames = $this->mapper->getEntities([Mode::NORMAL, Mode::WITH_DESCENDANTS]); } else { $entityNames = [$class]; $mode = $this->mapper->getEntityModeConfig($class); if ($mode === Mode::WITH_DESCENDANTS) { $entityNames = array_merge($entityNames, $this->mapper->getRegisteredDescendants($class)); } elseif ($mode === Mode::ONLY_DESCENDANTS) { $entityNames = $this->mapper->getRegisteredDescendants($class); } if (null === $offset && null === $limit || $offset === 0 && $limit) { foreach ($entityNames as $class) { $this->clearSearchIndexForEntity($class); } } } // index data by mapping config $recordsCount = 0; while ($class = array_shift($entityNames)) { $itemsCount = $this->reindexSingleEntity($class, $offset, $limit); $recordsCount += $itemsCount; } return $recordsCount; }
/** * {@inheritdoc} */ public function reindex($class = null) { if (null === $class) { $this->clearAllSearchIndexes(); $entityNames = $this->mapper->getEntities(); } else { $this->clearSearchIndexForEntity($class); $entityNames = array($class); } // index data by mapping config $recordsCount = 0; while ($class = array_shift($entityNames)) { $itemsCount = $this->reindexSingleEntity($class); $recordsCount += $itemsCount; } return $recordsCount; }
/** * Reload search index * * @return int Count of index records */ public function reindex() { //clear old index $this->clearSearchIndex(); //index data by mapping config $recordsCount = 0; $entities = $this->mapper->getEntities(); foreach ($entities as $entityName) { $entityData = $this->em->getRepository($entityName)->findAll(); foreach ($entityData as $entity) { if ($this->save($entity, true) !== false) { $recordsCount++; } } } $this->em->flush(); return $recordsCount; }
public function testGetEntities() { $entities = $this->mapper->getEntities(); $this->assertEquals(self::ENTITY_PRODUCT, $entities[1]); }
public function testGetEntities() { $entities = $this->mapper->getEntities(); $this->assertEquals('Oro\\Bundle\\SearchBundle\\Tests\\Unit\\Fixture\\Entity\\Product', $entities[1]); }