ShowOutOfStockConfig.php 982 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Catalog\Model\Plugin;
  7. class ShowOutOfStockConfig
  8. {
  9. /**
  10. * @var \Magento\Catalog\Model\Indexer\Product\Eav\Processor
  11. */
  12. protected $_eavIndexerProcessor;
  13. /**
  14. * @param \Magento\Catalog\Model\Indexer\Product\Eav\Processor $eavIndexerProcessor
  15. */
  16. public function __construct(\Magento\Catalog\Model\Indexer\Product\Eav\Processor $eavIndexerProcessor)
  17. {
  18. $this->_eavIndexerProcessor = $eavIndexerProcessor;
  19. }
  20. /**
  21. * After save handler
  22. *
  23. * @param \Magento\Framework\App\Config\Value $subject
  24. * @param mixed $result
  25. *
  26. * @return mixed
  27. */
  28. public function afterSave(\Magento\Framework\App\Config\Value $subject, $result)
  29. {
  30. if ($subject->isValueChanged()) {
  31. $this->_eavIndexerProcessor->markIndexerAsInvalid();
  32. }
  33. return $result;
  34. }
  35. }