6 declare(strict_types=1);
23 private $resourceConnection;
28 private $getProductTypesBySkus;
33 private $isSourceItemManagementAllowedForProductType;
47 $this->getProductTypesBySkus = $getProductTypesBySkus;
48 $this->isSourceItemManagementAllowedForProductType = $isSourceItemManagementAllowedForProductType;
61 string $destinationSource
63 $tableName = $this->resourceConnection->getTableName(
'inventory_low_stock_notification_configuration');
64 $connection = $this->resourceConnection->getConnection();
66 $types = $this->getProductTypesBySkus->execute(
$skus);
68 foreach ($types as $sku =>
$type) {
69 if ($this->isSourceItemManagementAllowedForProductType->execute(
$type)) {
70 foreach (
$skus as $sku) {
74 ->where(
'sku = ?', $sku)
75 ->where(
'source_code = ?', $originSource);
79 $notifyStockQty = ($res ===
null || $res ===
false) ?
null : (
float) $res;
84 'source_code' => $destinationSource,
86 'notify_stock_qty' => $notifyStockQty,
94 [
'notify_stock_qty' => $notifyStockQty],
96 $connection->quoteInto(
'source_code = ?', $destinationSource)
foreach($websiteCodes as $websiteCode) $skus
__construct(ResourceConnection $resourceConnection, GetProductTypesBySkusInterface $getProductTypesBySkus, IsSourceItemManagementAllowedForProductTypeInterface $isSourceItemManagementAllowedForProductType)
execute(array $skus, string $originSource, string $destinationSource)