Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GridSyncInsertObserver.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Sales\Observer;
7 
9 
17 {
23  protected $entityGrid;
24 
30  protected $globalConfig;
31 
36  public function __construct(
37  \Magento\Sales\Model\ResourceModel\GridInterface $entityGrid,
38  \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig
39  ) {
40  $this->entityGrid = $entityGrid;
41  $this->globalConfig = $globalConfig;
42  }
43 
61  public function execute(\Magento\Framework\Event\Observer $observer)
62  {
63  if (!$this->globalConfig->getValue('dev/grid/async_indexing')) {
64  $this->entityGrid->refresh($observer->getObject()->getId());
65  }
66  }
67 }
__construct(\Magento\Sales\Model\ResourceModel\GridInterface $entityGrid, \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig)
execute(\Magento\Framework\Event\Observer $observer)