Example #1
0
 /**
  * @param ShopIndex $index
  * @param ProgressHelperInterface $progress
  */
 public function populate(ShopIndex $index, ProgressHelperInterface $progress)
 {
     $categoryId = $index->getShop()->getCategory()->getId();
     $idQuery = $this->queryFactory->createCategoryQuery($categoryId, 100);
     $progress->start($idQuery->fetchCount(), 'Indexing products');
     while ($ids = $idQuery->fetch()) {
         $query = $this->queryFactory->createProductIdQuery($ids);
         $this->indexProducts($index, $query->fetch());
         $progress->advance(count(array_unique($ids)));
     }
     $progress->finish();
 }