6 declare(strict_types=1);
28 private $sourceItemRepository;
33 private $sourceItemsSave;
38 private $defaultSourceProvider;
43 private $searchCriteriaBuilder;
48 private $resourceConnection;
53 private $getSkusByProductIds;
76 $this->getSkusByProductIds = $getSkusByProductIds;
100 $connection = $this->resourceConnection->getConnection();
105 $this->updateSourceItemAtLegacyCatalogInventoryQtyCounter(
$items, $operator);
108 }
catch (\Exception $e) {
119 private function updateSourceItemAtLegacyCatalogInventoryQtyCounter(
120 array $productQuantitiesByProductId,
123 $productQuantitiesBySku = $this->getProductQuantitiesBySku($productQuantitiesByProductId);
127 array_keys($productQuantitiesBySku),
131 $this->defaultSourceProvider->getCode()
147 private function getProductQuantitiesBySku(array $productQuantitiesByProductId): array
149 $productSkus = $this->getSkusByProductIds->execute(array_keys($productQuantitiesByProductId));
151 $productQuantitiesBySku = [];
153 $productQuantitiesBySku[$productSku] = $productQuantitiesByProductId[
$productId];
155 return $productQuantitiesBySku;
aroundCorrectItemsQty(QtyCounterInterface $subject, callable $proceed, array $items, $websiteId, $operator)
__construct(SourceItemRepositoryInterface $sourceItemRepository, SourceItemsSaveInterface $sourceItemsSave, DefaultSourceProviderInterface $defaultSourceProvider, SearchCriteriaBuilder $searchCriteriaBuilder, ResourceConnection $resourceConnection, GetSkusByProductIdsInterface $getSkusByProductIds)