EnableEavIndexer.php 899 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\CatalogSearch\Plugin;
  8. /**
  9. * Enable Product EAV indexer in configuration for MySQL search engine
  10. *
  11. * @deprecated 101.0.0
  12. * @see \Magento\ElasticSearch
  13. */
  14. class EnableEavIndexer
  15. {
  16. /**
  17. * Config search engine path
  18. */
  19. const SEARCH_ENGINE_VALUE_PATH = 'groups/search/fields/engine/value';
  20. /**
  21. * @param \Magento\Config\Model\Config $subject
  22. */
  23. public function beforeSave(\Magento\Config\Model\Config $subject)
  24. {
  25. $searchEngine = $subject->getData(self::SEARCH_ENGINE_VALUE_PATH);
  26. if ($searchEngine === 'mysql') {
  27. $data = $subject->getData();
  28. $data['groups']['search']['fields']['enable_eav_indexer']['value'] = 1;
  29. $subject->setData($data);
  30. }
  31. }
  32. }