Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
DefaultStockPlugin.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
18 {
22  private $defaultStockProvider;
23 
27  public function __construct(
28  DefaultStockProviderInterface $defaultStockProvider
29  ) {
30  $this->defaultStockProvider = $defaultStockProvider;
31  }
32 
42  public function beforeDeleteById(StockRepositoryInterface $subject, int $stockId)
43  {
44  if ($stockId === $this->defaultStockProvider->getId()) {
45  throw new CouldNotDeleteException(__('Default Stock could not be deleted.'));
46  }
47  }
48 }
__()
Definition: __.php:13