Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Reindexing programmatically in Magento 2
* @license Open Software License (OSL 3.0)
* @author Hervé Guétin <> <@herveguetin>
class Reindex
* @var \Magento\Indexer\Console\Command\IndexerReindexCommand
private $reindexCommand;
public function __construct(
\Magento\Indexer\Console\Command\IndexerReindexCommand $reindexCommand
$this->reindexCommand = $reindexCommand;
public function reindexAll()
new \Symfony\Component\Console\Input\StringInput('index'),
new \Symfony\Component\Console\Output\ConsoleOutput()

This comment has been minimized.

Copy link

@gediminaskv gediminaskv commented May 13, 2017

I can't run reindexAll(), because of wrong instances... May you check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.