Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateItemsStockUponConfigChangeObserver.php
Go to the documentation of this file.
1 <?php
7 
12 
17 {
21  protected $resourceStockItem;
22 
27  {
28  $this->resourceStockItem = $resourceStockItem;
29  }
30 
37  public function execute(EventObserver $observer)
38  {
39  $website = (int) $observer->getEvent()->getWebsite();
40  $changedPaths = (array) $observer->getEvent()->getChangedPaths();
41 
42  if (\array_intersect([
47  ], $changedPaths)) {
48  $this->resourceStockItem->updateSetOutOfStock($website);
49  $this->resourceStockItem->updateSetInStock($website);
50  $this->resourceStockItem->updateLowStockDate($website);
51  }
52  }
53 }