Skip to content

Commit 641332d

Browse files
Merge remote-tracking branch '33499/2.4-develop-003' into Aug01-comprs
2 parents 53c9d62 + c86d43d commit 641332d

File tree

7 files changed

+78
-37
lines changed

7 files changed

+78
-37
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\CatalogInventory\Model;
77

88
use Magento\Catalog\Model\CollectionConditionInterface;
9-
use Magento\Eav\Model\Entity\Collection\AbstractCollection;
109
use Magento\Framework\Data\Collection\AbstractDb;
1110
use Magento\Framework\Data\CollectionModifierInterface;
1211

app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
3-
* Copyright 2015 Adobe
3+
* Copyright 2014 Adobe
44
* All Rights Reserved.
55
*/
66

77
namespace Magento\CatalogInventory\Model\ResourceModel\Stock\Item;
88

9+
use Magento\CatalogInventory\Api\StockItemCriteriaInterface;
910
use Magento\Framework\Data\AbstractCriteria;
10-
use Magento\CatalogInventory\Model\ResourceModel\Stock\Item\StockItemCriteriaMapper;
1111

1212
/**
13-
* Class StockItemCriteria
13+
* Class StockItemCriteria Resource model
1414
*/
15-
class StockItemCriteria extends AbstractCriteria implements \Magento\CatalogInventory\Api\StockItemCriteriaInterface
15+
class StockItemCriteria extends AbstractCriteria implements StockItemCriteriaInterface
1616
{
1717
/**
1818
* @param string $mapper
@@ -80,10 +80,10 @@ public function setQtyFilter($comparisonMethod, $qty)
8080
/**
8181
* Add Criteria object
8282
*
83-
* @param \Magento\CatalogInventory\Api\StockItemCriteriaInterface $criteria
83+
* @param StockItemCriteriaInterface $criteria
8484
* @return bool
8585
*/
86-
public function addCriteria(\Magento\CatalogInventory\Api\StockItemCriteriaInterface $criteria)
86+
public function addCriteria(StockItemCriteriaInterface $criteria)
8787
{
8888
$this->data[self::PART_CRITERIA_LIST]['list'][] = $criteria;
8989
return true;

app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
/**
3-
* Copyright 2015 Adobe
3+
* Copyright 2014 Adobe
44
* All Rights Reserved.
55
*/
66

77
namespace Magento\CatalogInventory\Model\ResourceModel\Stock\Status;
88

9+
use Magento\CatalogInventory\Api\StockStatusCriteriaInterface;
910
use Magento\Framework\Data\AbstractCriteria;
10-
use Magento\CatalogInventory\Model\ResourceModel\Stock\Status\StockStatusCriteriaMapper;
1111

1212
/**
13-
* Class StockStatusCriteria
13+
* Class StockStatusCriteria Resource model
1414
*/
15-
class StockStatusCriteria extends AbstractCriteria implements \Magento\CatalogInventory\Api\StockStatusCriteriaInterface
15+
class StockStatusCriteria extends AbstractCriteria implements StockStatusCriteriaInterface
1616
{
1717
/**
1818
* @param string $mapper
@@ -24,33 +24,45 @@ public function __construct($mapper = '')
2424
}
2525

2626
/**
27-
* @inheritdoc
27+
* Filter by scope(s)
28+
*
29+
* @param int $scope
30+
* @return void
2831
*/
2932
public function setScopeFilter($scope)
3033
{
3134
$this->data['website_filter'] = [$scope];
3235
}
3336

3437
/**
35-
* @inheritdoc
38+
* Add product(s) filter
39+
*
40+
* @param int $products
41+
* @return void
3642
*/
3743
public function setProductsFilter($products)
3844
{
3945
$this->data['products_filter'] = [$products];
4046
}
4147

4248
/**
43-
* @inheritdoc
49+
* Add filter by quantity
50+
*
51+
* @param float $qty
52+
* @return void
4453
*/
4554
public function setQtyFilter($qty)
4655
{
4756
$this->data['qty_filter'] = [$qty];
4857
}
4958

5059
/**
51-
* @inheritdoc
60+
* Add Criteria object
61+
*
62+
* @param \Magento\CatalogInventory\Api\StockStatusCriteriaInterface $criteria
63+
* @return void
5264
*/
53-
public function addCriteria(\Magento\CatalogInventory\Api\StockStatusCriteriaInterface $criteria)
65+
public function addCriteria(StockStatusCriteriaInterface $criteria)
5466
{
5567
$this->data[self::PART_CRITERIA_LIST]['list'][] = $criteria;
5668
}

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface;
1616

1717
/**
18-
* Class StockRegistry
18+
* Class Catalog StockRegistry
1919
*
2020
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2121
*/
@@ -68,6 +68,8 @@ public function __construct(
6868
}
6969

7070
/**
71+
* Get Stock data
72+
*
7173
* @param int $scopeId
7274
* @return \Magento\CatalogInventory\Api\Data\StockInterface
7375
*/
@@ -78,9 +80,11 @@ public function getStock($scopeId = null)
7880
}
7981

8082
/**
83+
* Get Stock Item data
84+
*
8185
* @param int $productId
8286
* @param int $scopeId
83-
* @return \Magento\CatalogInventory\Api\Data\StockItemInterface
87+
* @return StockItemInterface
8488
*/
8589
public function getStockItem($productId, $scopeId = null)
8690
{
@@ -89,9 +93,11 @@ public function getStockItem($productId, $scopeId = null)
8993
}
9094

9195
/**
96+
* Get Stock Item By SKU
97+
*
9298
* @param string $productSku
9399
* @param int $scopeId
94-
* @return \Magento\CatalogInventory\Api\Data\StockItemInterface
100+
* @return StockItemInterface
95101
* @throws \Magento\Framework\Exception\NoSuchEntityException
96102
*/
97103
public function getStockItemBySku($productSku, $scopeId = null)
@@ -102,6 +108,8 @@ public function getStockItemBySku($productSku, $scopeId = null)
102108
}
103109

104110
/**
111+
* Get Stock status
112+
*
105113
* @param int $productId
106114
* @param int $scopeId
107115
* @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
@@ -113,6 +121,8 @@ public function getStockStatus($productId, $scopeId = null)
113121
}
114122

115123
/**
124+
* Get Stock status by SKU
125+
*
116126
* @param string $productSku
117127
* @param int $scopeId
118128
* @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
@@ -127,6 +137,7 @@ public function getStockStatusBySku($productSku, $scopeId = null)
127137

128138
/**
129139
* Retrieve Product stock status
140+
*
130141
* @param int $productId
131142
* @param int $scopeId
132143
* @return int
@@ -139,8 +150,10 @@ public function getProductStockStatus($productId, $scopeId = null)
139150
}
140151

141152
/**
153+
* Get Product Stock status by SKU
154+
*
142155
* @param string $productSku
143-
* @param null $scopeId
156+
* @param null|int $scopeId
144157
* @return int
145158
* @throws \Magento\Framework\Exception\NoSuchEntityException
146159
*/
@@ -167,7 +180,7 @@ public function getLowStockItems($scopeId, $qty, $currentPage = 1, $pageSize = 0
167180
/**
168181
* @inheritdoc
169182
*/
170-
public function updateStockItemBySku($productSku, \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem)
183+
public function updateStockItemBySku($productSku, StockItemInterface $stockItem)
171184
{
172185
$productId = $this->resolveProductId($productSku);
173186
$websiteId = $stockItem->getWebsiteId() ?: null;
@@ -182,6 +195,8 @@ public function updateStockItemBySku($productSku, \Magento\CatalogInventory\Api\
182195
}
183196

184197
/**
198+
* Resolve the Product Id
199+
*
185200
* @param string $productSku
186201
* @return int
187202
* @throws \Magento\Framework\Exception\NoSuchEntityException

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
use Magento\CatalogInventory\Api\StockCriteriaInterfaceFactory;
1616
use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory;
1717
use Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory;
18-
use Magento\Store\Model\StoreManagerInterface;
1918

2019
/**
21-
* Class StockRegistryProvider
20+
* Class Catalog StockRegistryProvider
2221
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2322
*/
2423
class StockRegistryProvider implements StockRegistryProviderInterface
@@ -108,6 +107,8 @@ public function __construct(
108107
}
109108

110109
/**
110+
* Get Stock
111+
*
111112
* @param int|null $scopeId
112113
* @return \Magento\CatalogInventory\Api\Data\StockInterface
113114
*/
@@ -129,6 +130,8 @@ public function getStock($scopeId)
129130
}
130131

131132
/**
133+
* Get Stock Item
134+
*
132135
* @param int $productId
133136
* @param int $scopeId
134137
* @return \Magento\CatalogInventory\Api\Data\StockItemInterface
@@ -151,6 +154,8 @@ public function getStockItem($productId, $scopeId)
151154
}
152155

153156
/**
157+
* Get Stock Status
158+
*
154159
* @param int $productId
155160
* @param int $scopeId
156161
* @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
@@ -174,6 +179,8 @@ public function getStockStatus($productId, $scopeId)
174179
}
175180

176181
/**
182+
* Get Stock Registry Storage
183+
*
177184
* @return StockRegistryStorage
178185
*/
179186
private function getStockRegistryStorage()

app/code/Magento/CatalogInventory/Setup/Patch/Data/CreateDefaultStock.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88

99
use Magento\Eav\Setup\EavSetup;
1010
use Magento\Eav\Setup\EavSetupFactory;
11-
use Magento\Framework\App\ResourceConnection;
1211
use Magento\Framework\Setup\ModuleDataSetupInterface;
1312
use Magento\Framework\Setup\Patch\DataPatchInterface;
1413
use Magento\Framework\Setup\Patch\PatchVersionInterface;
1514

1615
/**
17-
* Class CreateDefaultStock
18-
* @package Magento\CatalogInventory\Setup\Patch
16+
* Class CreateDefaultStock patch
1917
*/
2018
class CreateDefaultStock implements DataPatchInterface, PatchVersionInterface
2119
{
@@ -43,7 +41,13 @@ public function __construct(
4341
}
4442

4543
/**
46-
* {@inheritdoc}
44+
* Run code inside patch
45+
* If code fails, patch must be reverted, in case when we are speaking about schema - then under revert
46+
* means run PatchInterface::revert()
47+
*
48+
* If we speak about data, under revert means: $transaction->rollback()
49+
*
50+
* @return void
4751
*/
4852
public function apply()
4953
{
@@ -66,23 +70,23 @@ public function apply()
6670
}
6771

6872
/**
69-
* {@inheritdoc}
73+
* @inheritdoc
7074
*/
7175
public static function getDependencies()
7276
{
7377
return [];
7478
}
7579

7680
/**
77-
* {@inheritdoc}
81+
* @inheritdoc
7882
*/
7983
public static function getVersion()
8084
{
8185
return '2.0.0';
8286
}
8387

8488
/**
85-
* {@inheritdoc}
89+
* @inheritdoc
8690
*/
8791
public function getAliases()
8892
{

app/code/Magento/CatalogInventory/Setup/Patch/Data/UpdateStockItemsWebsite.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
namespace Magento\CatalogInventory\Setup\Patch\Data;
88

99
use Magento\CatalogInventory\Model\Indexer\Stock\Processor;
10-
use Magento\Framework\App\ResourceConnection;
1110
use Magento\Framework\Setup\ModuleDataSetupInterface;
1211
use Magento\Framework\Setup\Patch\DataPatchInterface;
1312
use Magento\Framework\Setup\Patch\PatchVersionInterface;
1413

1514
/**
16-
* Class UpdateStockItemsWebsite
17-
* @package Magento\CatalogInventory\Setup\Patch
15+
* Class UpdateStockItemsWebsite patch
1816
*/
1917
class UpdateStockItemsWebsite implements DataPatchInterface, PatchVersionInterface
2018
{
@@ -58,7 +56,13 @@ public function __construct(
5856
}
5957

6058
/**
61-
* {@inheritdoc}
59+
* Run code inside patch
60+
* If code fails, patch must be reverted, in case when we are speaking about schema - then under revert
61+
* means run PatchInterface::revert()
62+
*
63+
* If we speak about data, under revert means: $transaction->rollback()
64+
*
65+
* @return void
6266
*/
6367
public function apply()
6468
{
@@ -71,7 +75,7 @@ public function apply()
7175
}
7276

7377
/**
74-
* {@inheritdoc}
78+
* @inheritdoc
7579
*/
7680
public static function getDependencies()
7781
{
@@ -81,15 +85,15 @@ public static function getDependencies()
8185
}
8286

8387
/**
84-
* {@inheritdoc}
88+
* @inheritdoc
8589
*/
8690
public static function getVersion()
8791
{
8892
return '2.2.0';
8993
}
9094

9195
/**
92-
* {@inheritdoc}
96+
* @inheritdoc
9397
*/
9498
public function getAliases()
9599
{

0 commit comments

Comments
 (0)