Skip to content

Commit 4eb6a59

Browse files
[Magento Community Engineering] Community Contributions - 2.4-develop-fast-lane-prs
- merged with '2.4-develop-expedited-prs' branch
2 parents ed0a36b + 1f09cf2 commit 4eb6a59

File tree

26 files changed

+866
-599
lines changed

26 files changed

+866
-599
lines changed

app/code/Magento/CatalogInventory/Model/StockState.php

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
use Magento\CatalogInventory\Api\StockStateInterface;
1010
use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface;
1111
use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface;
12+
use Magento\Framework\DataObject;
1213

1314
/**
15+
* Provides functionality for stock state information
16+
*
1417
* Interface StockState
1518
*/
1619
class StockState implements StockStateInterface
@@ -31,6 +34,8 @@ class StockState implements StockStateInterface
3134
protected $stockConfiguration;
3235

3336
/**
37+
* StockState constructor
38+
*
3439
* @param StockStateProviderInterface $stockStateProvider
3540
* @param StockRegistryProviderInterface $stockRegistryProvider
3641
* @param StockConfigurationInterface $stockConfiguration
@@ -46,30 +51,32 @@ public function __construct(
4651
}
4752

4853
/**
54+
* Verify stock by product id
55+
*
4956
* @param int $productId
5057
* @param int $scopeId
5158
* @return bool
5259
*/
5360
public function verifyStock($productId, $scopeId = null)
5461
{
55-
// if ($scopeId === null) {
56-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
57-
// }
62+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
5863
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
64+
5965
return $this->stockStateProvider->verifyStock($stockItem);
6066
}
6167

6268
/**
69+
* Verify notification by product id
70+
*
6371
* @param int $productId
6472
* @param int $scopeId
6573
* @return bool
6674
*/
6775
public function verifyNotification($productId, $scopeId = null)
6876
{
69-
// if ($scopeId === null) {
70-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
71-
// }
77+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
7278
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
79+
7380
return $this->stockStateProvider->verifyNotification($stockItem);
7481
}
7582

@@ -84,16 +91,14 @@ public function verifyNotification($productId, $scopeId = null)
8491
*/
8592
public function checkQty($productId, $qty, $scopeId = null)
8693
{
87-
// if ($scopeId === null) {
88-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
89-
// }
94+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
9095
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
96+
9197
return $this->stockStateProvider->checkQty($stockItem, $qty);
9298
}
9399

94100
/**
95-
* Returns suggested qty that satisfies qty increments and minQty/maxQty/minSaleQty/maxSaleQty conditions
96-
* or original qty if such value does not exist
101+
* Returns suggested qty that satisfies qty increments/minQty/maxQty/minSaleQty/maxSaleQty else returns original qty
97102
*
98103
* @param int $productId
99104
* @param float $qty
@@ -102,10 +107,9 @@ public function checkQty($productId, $qty, $scopeId = null)
102107
*/
103108
public function suggestQty($productId, $qty, $scopeId = null)
104109
{
105-
// if ($scopeId === null) {
106-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
107-
// }
110+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
108111
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
112+
109113
return $this->stockStateProvider->suggestQty($stockItem, $qty);
110114
}
111115

@@ -118,29 +122,31 @@ public function suggestQty($productId, $qty, $scopeId = null)
118122
*/
119123
public function getStockQty($productId, $scopeId = null)
120124
{
121-
// if ($scopeId === null) {
122-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
123-
// }
125+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
124126
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
127+
125128
return $this->stockStateProvider->getStockQty($stockItem);
126129
}
127130

128131
/**
132+
* Check qty increments by product id
133+
*
129134
* @param int $productId
130135
* @param float $qty
131136
* @param int $websiteId
132-
* @return \Magento\Framework\DataObject
137+
* @return DataObject
133138
*/
134139
public function checkQtyIncrements($productId, $qty, $websiteId = null)
135140
{
136-
// if ($websiteId === null) {
137-
$websiteId = $this->stockConfiguration->getDefaultScopeId();
138-
// }
141+
$websiteId = $this->stockConfiguration->getDefaultScopeId();
139142
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $websiteId);
143+
140144
return $this->stockStateProvider->checkQtyIncrements($stockItem, $qty);
141145
}
142146

143147
/**
148+
* Check quote item qty
149+
*
144150
* @param int $productId
145151
* @param float $itemQty
146152
* @param float $qtyToCheck
@@ -150,10 +156,9 @@ public function checkQtyIncrements($productId, $qty, $websiteId = null)
150156
*/
151157
public function checkQuoteItemQty($productId, $itemQty, $qtyToCheck, $origQty, $scopeId = null)
152158
{
153-
// if ($scopeId === null) {
154-
$scopeId = $this->stockConfiguration->getDefaultScopeId();
155-
// }
159+
$scopeId = $this->stockConfiguration->getDefaultScopeId();
156160
$stockItem = $this->stockRegistryProvider->getStockItem($productId, $scopeId);
161+
157162
return $this->stockStateProvider->checkQuoteItemQty($stockItem, $itemQty, $qtyToCheck, $origQty);
158163
}
159164
}

app/code/Magento/MediaGalleryCatalogUi/etc/adminhtml/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<argument name="entityType" xsi:type="string">catalog_category</argument>
2525
</arguments>
2626
</virtualType>
27-
<type name="Magento\MediaGalleryUi\Model\AssetDetailsProvider\UsedIn">
27+
<type name="Magento\MediaGalleryUi\Model\GetAssetUsageDetails">
2828
<arguments>
2929
<argument name="contentTypes" xsi:type="array">
3030
<item name="catalog_category" xsi:type="array">

app/code/Magento/MediaGalleryCmsUi/etc/adminhtml/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<argument name="entityType" xsi:type="string">cms_block</argument>
2525
</arguments>
2626
</virtualType>
27-
<type name="Magento\MediaGalleryUi\Model\AssetDetailsProvider\UsedIn">
27+
<type name="Magento\MediaGalleryUi\Model\GetAssetUsageDetails">
2828
<arguments>
2929
<argument name="contentTypes" xsi:type="array">
3030
<item name="cms_block" xsi:type="array">

app/code/Magento/MediaGalleryUi/Model/AssetDetailsProvider/CreatedAt.php

Lines changed: 0 additions & 59 deletions
This file was deleted.

app/code/Magento/MediaGalleryUi/Model/AssetDetailsProvider/Height.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

app/code/Magento/MediaGalleryUi/Model/AssetDetailsProvider/Size.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

app/code/Magento/MediaGalleryUi/Model/AssetDetailsProvider/Type.php

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)