diff --git a/app/code/Magento/CatalogInventory/Model/ProductCollectionStockCondition.php b/app/code/Magento/CatalogInventory/Model/ProductCollectionStockCondition.php index 28af97ff3fe2b..fb2f3ec9f222e 100644 --- a/app/code/Magento/CatalogInventory/Model/ProductCollectionStockCondition.php +++ b/app/code/Magento/CatalogInventory/Model/ProductCollectionStockCondition.php @@ -6,7 +6,6 @@ namespace Magento\CatalogInventory\Model; use Magento\Catalog\Model\CollectionConditionInterface; -use Magento\Eav\Model\Entity\Collection\AbstractCollection; use Magento\Framework\Data\Collection\AbstractDb; use Magento\Framework\Data\CollectionModifierInterface; diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php index 47359f970e93f..b93ff611c24aa 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteria.php @@ -1,18 +1,18 @@ data[self::PART_CRITERIA_LIST]['list'][] = $criteria; return true; diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php index 3f891da50e7e6..f59fcd1d53aca 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteria.php @@ -1,18 +1,18 @@ data[self::PART_CRITERIA_LIST]['list'][] = $criteria; } diff --git a/app/code/Magento/CatalogInventory/Model/StockRegistry.php b/app/code/Magento/CatalogInventory/Model/StockRegistry.php index 6597b58942216..4eec4b9161cee 100644 --- a/app/code/Magento/CatalogInventory/Model/StockRegistry.php +++ b/app/code/Magento/CatalogInventory/Model/StockRegistry.php @@ -15,7 +15,7 @@ use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface; /** - * Class StockRegistry + * Class Catalog StockRegistry * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -68,6 +68,8 @@ public function __construct( } /** + * Get Stock data + * * @param int $scopeId * @return \Magento\CatalogInventory\Api\Data\StockInterface */ @@ -78,9 +80,11 @@ public function getStock($scopeId = null) } /** + * Get Stock Item data + * * @param int $productId * @param int $scopeId - * @return \Magento\CatalogInventory\Api\Data\StockItemInterface + * @return StockItemInterface */ public function getStockItem($productId, $scopeId = null) { @@ -89,9 +93,11 @@ public function getStockItem($productId, $scopeId = null) } /** + * Get Stock Item By SKU + * * @param string $productSku * @param int $scopeId - * @return \Magento\CatalogInventory\Api\Data\StockItemInterface + * @return StockItemInterface * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function getStockItemBySku($productSku, $scopeId = null) @@ -102,6 +108,8 @@ public function getStockItemBySku($productSku, $scopeId = null) } /** + * Get Stock status + * * @param int $productId * @param int $scopeId * @return \Magento\CatalogInventory\Api\Data\StockStatusInterface @@ -113,6 +121,8 @@ public function getStockStatus($productId, $scopeId = null) } /** + * Get Stock status by SKU + * * @param string $productSku * @param int $scopeId * @return \Magento\CatalogInventory\Api\Data\StockStatusInterface @@ -127,6 +137,7 @@ public function getStockStatusBySku($productSku, $scopeId = null) /** * Retrieve Product stock status + * * @param int $productId * @param int $scopeId * @return int @@ -139,8 +150,10 @@ public function getProductStockStatus($productId, $scopeId = null) } /** + * Get Product Stock status by SKU + * * @param string $productSku - * @param null $scopeId + * @param null|int $scopeId * @return int * @throws \Magento\Framework\Exception\NoSuchEntityException */ @@ -167,7 +180,7 @@ public function getLowStockItems($scopeId, $qty, $currentPage = 1, $pageSize = 0 /** * @inheritdoc */ - public function updateStockItemBySku($productSku, \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem) + public function updateStockItemBySku($productSku, StockItemInterface $stockItem) { $productId = $this->resolveProductId($productSku); $websiteId = $stockItem->getWebsiteId() ?: null; @@ -182,6 +195,8 @@ public function updateStockItemBySku($productSku, \Magento\CatalogInventory\Api\ } /** + * Resolve the Product Id + * * @param string $productSku * @return int * @throws \Magento\Framework\Exception\NoSuchEntityException diff --git a/app/code/Magento/CatalogInventory/Model/StockRegistryProvider.php b/app/code/Magento/CatalogInventory/Model/StockRegistryProvider.php index fea503f49efe0..b68f974867dc2 100644 --- a/app/code/Magento/CatalogInventory/Model/StockRegistryProvider.php +++ b/app/code/Magento/CatalogInventory/Model/StockRegistryProvider.php @@ -15,10 +15,9 @@ use Magento\CatalogInventory\Api\StockCriteriaInterfaceFactory; use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory; use Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory; -use Magento\Store\Model\StoreManagerInterface; /** - * Class StockRegistryProvider + * Class Catalog StockRegistryProvider * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class StockRegistryProvider implements StockRegistryProviderInterface @@ -108,6 +107,8 @@ public function __construct( } /** + * Get Stock + * * @param int|null $scopeId * @return \Magento\CatalogInventory\Api\Data\StockInterface */ @@ -129,6 +130,8 @@ public function getStock($scopeId) } /** + * Get Stock Item + * * @param int $productId * @param int $scopeId * @return \Magento\CatalogInventory\Api\Data\StockItemInterface @@ -151,6 +154,8 @@ public function getStockItem($productId, $scopeId) } /** + * Get Stock Status + * * @param int $productId * @param int $scopeId * @return \Magento\CatalogInventory\Api\Data\StockStatusInterface @@ -174,6 +179,8 @@ public function getStockStatus($productId, $scopeId) } /** + * Get Stock Registry Storage + * * @return StockRegistryStorage */ private function getStockRegistryStorage() diff --git a/app/code/Magento/CatalogInventory/Setup/Patch/Data/CreateDefaultStock.php b/app/code/Magento/CatalogInventory/Setup/Patch/Data/CreateDefaultStock.php index 5deea1ed0b8df..292fc4dc20bf4 100644 --- a/app/code/Magento/CatalogInventory/Setup/Patch/Data/CreateDefaultStock.php +++ b/app/code/Magento/CatalogInventory/Setup/Patch/Data/CreateDefaultStock.php @@ -8,14 +8,12 @@ use Magento\Eav\Setup\EavSetup; use Magento\Eav\Setup\EavSetupFactory; -use Magento\Framework\App\ResourceConnection; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchVersionInterface; /** - * Class CreateDefaultStock - * @package Magento\CatalogInventory\Setup\Patch + * Class CreateDefaultStock patch */ class CreateDefaultStock implements DataPatchInterface, PatchVersionInterface { @@ -43,7 +41,13 @@ public function __construct( } /** - * {@inheritdoc} + * Run code inside patch + * If code fails, patch must be reverted, in case when we are speaking about schema - then under revert + * means run PatchInterface::revert() + * + * If we speak about data, under revert means: $transaction->rollback() + * + * @return void */ public function apply() { @@ -66,7 +70,7 @@ public function apply() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -74,7 +78,7 @@ public static function getDependencies() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getVersion() { @@ -82,7 +86,7 @@ public static function getVersion() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() { diff --git a/app/code/Magento/CatalogInventory/Setup/Patch/Data/UpdateStockItemsWebsite.php b/app/code/Magento/CatalogInventory/Setup/Patch/Data/UpdateStockItemsWebsite.php index 6580c4651f377..e39ad4a236ec6 100644 --- a/app/code/Magento/CatalogInventory/Setup/Patch/Data/UpdateStockItemsWebsite.php +++ b/app/code/Magento/CatalogInventory/Setup/Patch/Data/UpdateStockItemsWebsite.php @@ -7,14 +7,12 @@ namespace Magento\CatalogInventory\Setup\Patch\Data; use Magento\CatalogInventory\Model\Indexer\Stock\Processor; -use Magento\Framework\App\ResourceConnection; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchVersionInterface; /** - * Class UpdateStockItemsWebsite - * @package Magento\CatalogInventory\Setup\Patch + * Class UpdateStockItemsWebsite patch */ class UpdateStockItemsWebsite implements DataPatchInterface, PatchVersionInterface { @@ -58,7 +56,13 @@ public function __construct( } /** - * {@inheritdoc} + * Run code inside patch + * If code fails, patch must be reverted, in case when we are speaking about schema - then under revert + * means run PatchInterface::revert() + * + * If we speak about data, under revert means: $transaction->rollback() + * + * @return void */ public function apply() { @@ -71,7 +75,7 @@ public function apply() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getDependencies() { @@ -81,7 +85,7 @@ public static function getDependencies() } /** - * {@inheritdoc} + * @inheritdoc */ public static function getVersion() { @@ -89,7 +93,7 @@ public static function getVersion() } /** - * {@inheritdoc} + * @inheritdoc */ public function getAliases() {