Skip to content

Commit fa856cd

Browse files
author
Oleksandr Dubovyk
committed
MAGETWO-99585: When backorders are allowed on an item, the qty_backordered value in sales_order_item is 0
- backward compat constructor
1 parent 96aaf95 commit fa856cd

File tree

1 file changed

+5
-3
lines changed
  • app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer

1 file changed

+5
-3
lines changed

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\CatalogInventory\Api\Data\StockItemInterface;
1111
use Magento\CatalogInventory\Model\Quote\Item\QuantityValidator\QuoteItemQtyList;
1212
use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface;
13+
use Magento\Framework\App\ObjectManager;
1314
use Magento\Quote\Model\Quote\Item;
1415

1516
/**
@@ -41,18 +42,19 @@ class StockItem
4142
* @param ConfigInterface $typeConfig
4243
* @param QuoteItemQtyList $quoteItemQtyList
4344
* @param StockStateInterface $stockState
44-
* @param StockStateProviderInterface $stockStateProvider
45+
* @param StockStateProviderInterface|null $stockStateProvider
4546
*/
4647
public function __construct(
4748
ConfigInterface $typeConfig,
4849
QuoteItemQtyList $quoteItemQtyList,
4950
StockStateInterface $stockState,
50-
StockStateProviderInterface $stockStateProvider
51+
StockStateProviderInterface $stockStateProvider = null
5152
) {
5253
$this->quoteItemQtyList = $quoteItemQtyList;
5354
$this->typeConfig = $typeConfig;
5455
$this->stockState = $stockState;
55-
$this->stockStateProvider = $stockStateProvider;
56+
$this->stockStateProvider = $stockStateProvider ?: ObjectManager::getInstance()
57+
->get(StockStateProviderInterface::class);
5658
}
5759

5860
/**

0 commit comments

Comments
 (0)