Website.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\CatalogRule\Plugin\Indexer;
  7. use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
  8. class Website
  9. {
  10. /**
  11. * @var RuleProductProcessor
  12. */
  13. protected $ruleProductProcessor;
  14. /**
  15. * @param RuleProductProcessor $ruleProductProcessor
  16. */
  17. public function __construct(RuleProductProcessor $ruleProductProcessor)
  18. {
  19. $this->ruleProductProcessor = $ruleProductProcessor;
  20. }
  21. /**
  22. * Invalidate catalog price rule indexer
  23. *
  24. * @param \Magento\Store\Model\Website $subject
  25. * @param \Magento\Store\Model\Website $result
  26. * @return \Magento\Store\Model\Website
  27. *
  28. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  29. */
  30. public function afterDelete(
  31. \Magento\Store\Model\Website $subject,
  32. \Magento\Store\Model\Website $result
  33. ) {
  34. $this->ruleProductProcessor->markIndexerAsInvalid();
  35. return $result;
  36. }
  37. }