123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Sales\Observer\Backend;
- use Magento\Framework\Event\ObserverInterface;
- class SubtractQtyFromQuotesObserver implements ObserverInterface
- {
- /**
- * @var \Magento\Quote\Model\ResourceModel\Quote
- */
- protected $_quote;
- /**
- * @param \Magento\Quote\Model\ResourceModel\Quote $quote
- */
- public function __construct(\Magento\Quote\Model\ResourceModel\Quote $quote)
- {
- $this->_quote = $quote;
- }
- /**
- * When deleting product, subtract it from all quotes quantities
- *
- * @param \Magento\Framework\Event\Observer $observer
- * @return void
- */
- public function execute(\Magento\Framework\Event\Observer $observer)
- {
- $product = $observer->getEvent()->getProduct();
- $this->_quote->subtractProductFromQuotes($product);
- }
- }
|