/** * Execute materialization on ids entities * * @param int[] $ids * @return void */ public function execute($ids) { $this->indexer->load(self::INDEXER_ID); /** @var Fulltext\Action\Rows $action */ $action = $this->rowsActionFactory->create(); $action->reindex($ids); }
public function testExecuteWithIndexerNotWorking() { $ids = [1, 2, 3]; $this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(false)); $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false)); $this->prepareIndexer(); $rowMock = $this->getMock('Magento\\Catalog\\Model\\Indexer\\Category\\Flat\\Action\\Rows', ['reindex'], [], '', false); $rowMock->expects($this->once())->method('reindex')->with($ids, false)->will($this->returnSelf()); $this->rowsMock->expects($this->once())->method('create')->will($this->returnValue($rowMock)); $this->model->execute($ids); }
public function testExecuteWithIndexerNotWorking() { $ids = array(1, 2, 3); $this->indexerMock->expects($this->once())->method('load')->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)->will($this->returnSelf()); $this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(false)); $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false)); $rowMock = $this->getMock('Magento\\Catalog\\Model\\Indexer\\Category\\Flat\\Action\\Rows', array('reindex'), array(), '', false); $rowMock->expects($this->once())->method('reindex')->with($ids, false)->will($this->returnSelf()); $this->rowsMock->expects($this->once())->method('create')->will($this->returnValue($rowMock)); $this->model->execute($ids); }
/** * Execute materialization on ids entities * * @param int[] $ids * @return void */ public function execute($ids) { $indexer = $this->indexerRegistry->get(Flat\State::INDEXER_ID); if ($indexer->isInvalid()) { return; } /** @var Flat\Action\Rows $action */ $action = $this->rowsActionFactory->create(); if ($indexer->isWorking()) { $action->reindex($ids, true); } $action->reindex($ids); }
/** * Execute materialization on ids entities * * @param int[] $ids * @return void */ public function execute($ids) { $indexer = $this->indexerRegistry->get(Flat\State::INDEXER_ID); if ($indexer->isInvalid()) { return; } /** @var Flat\Action\Rows $action */ $action = $this->rowsActionFactory->create(); if ($indexer->isWorking()) { $action->reindex($ids, true); } $action->reindex($ids); $this->getCacheContext()->registerEntities(\Magento\Catalog\Model\Category::CACHE_TAG, $ids); }