Action.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\CatalogSearch\Model\Indexer\Mview;
  7. use Magento\CatalogSearch\Model\Indexer\Fulltext;
  8. use Magento\Framework\Mview\ActionInterface;
  9. use Magento\Framework\Indexer\IndexerInterfaceFactory;
  10. /**
  11. * Catalog search materialized view index action.
  12. */
  13. class Action implements ActionInterface
  14. {
  15. /**
  16. * @var IndexerInterfaceFactory
  17. */
  18. private $indexerFactory;
  19. /**
  20. * @param IndexerInterfaceFactory $indexerFactory
  21. */
  22. public function __construct(IndexerInterfaceFactory $indexerFactory)
  23. {
  24. $this->indexerFactory = $indexerFactory;
  25. }
  26. /**
  27. * Execute materialization on ids entities
  28. *
  29. * @param int[] $ids
  30. * @return void
  31. * @api
  32. */
  33. public function execute($ids)
  34. {
  35. /** @var \Magento\Framework\Indexer\IndexerInterface $indexer */
  36. $indexer = $this->indexerFactory->create()->load(Fulltext::INDEXER_ID);
  37. $indexer->reindexList($ids);
  38. }
  39. }