Skip to content

Commit

Permalink
Fixed static test checks issues
Browse files Browse the repository at this point in the history
  • Loading branch information
VitaliyBoyko committed May 19, 2018
1 parent 1f9dd5e commit ab39b56
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
13 changes: 10 additions & 3 deletions app/code/Magento/InventoryCache/Model/FlushCacheByProductIds.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Magento\InventoryCache\Model;

use Magento\Catalog\Model\Product;
use Magento\Framework\EntityManager\EventManager;
use Magento\Framework\Indexer\CacheContext;

Expand All @@ -26,16 +25,24 @@ class FlushCacheByProductIds
*/
private $eventManager;

/**
* @var string
*/
private $productCacheTag;

/**
* @param CacheContext $cacheContext
* @param EventManager $eventManager
* @param string $productCacheTag
*/
public function __construct(
CacheContext $cacheContext,
EventManager $eventManager
EventManager $eventManager,
string $productCacheTag
) {
$this->cacheContext = $cacheContext;
$this->eventManager = $eventManager;
$this->productCacheTag = $productCacheTag;
}

/**
Expand All @@ -47,7 +54,7 @@ public function __construct(
public function execute(array $productIds)
{
if ($productIds) {
$this->cacheContext->registerEntities(Product::CACHE_TAG, $productIds);
$this->cacheContext->registerEntities($this->productCacheTag, $productIds);
$this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ class GetProductIdsByStockIds
* @param StockIndexTableNameResolverInterface $stockIndexTableNameResolver
* @param DefaultStockProviderInterface $defaultStockProvider
* @param IndexStructure $indexStructure
* @param $productSkuColumn
* @param $productInterfaceClassName
* @param string $productSkuColumn
* @param string $productInterfaceClassName
*/
public function __construct(
ResourceConnection $resource,
MetadataPool $metadataPool,
StockIndexTableNameResolverInterface $stockIndexTableNameResolver,
DefaultStockProviderInterface $defaultStockProvider,
IndexStructure $indexStructure,
$productSkuColumn,
$productInterfaceClassName
string $productSkuColumn,
string $productInterfaceClassName
) {
$this->resource = $resource;
$this->metadataPool = $metadataPool;
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/InventoryCache/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@
<argument name="productInterfaceClassName" xsi:type="string">Magento\Catalog\Api\Data\ProductInterface</argument>
</arguments>
</type>
<type name="Magento\InventoryCache\Model\FlushCacheByProductIds">
<arguments>
<argument name="productCacheTag" xsi:type="const">Magento\Catalog\Model\Product::CACHE_TAG</argument>
</arguments>
</type>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ class GetProductIdsBySourceItemIds
* @param MetadataPool $metadataPool
* @param string $tableNameSourceItem
* @param string $sourceItemIdFieldName
* @param $productInterfaceClassName
* @param string $productInterfaceClassName
*/
public function __construct(
ResourceConnection $resource,
MetadataPool $metadataPool,
$tableNameSourceItem,
$sourceItemIdFieldName,
$productInterfaceClassName
string $tableNameSourceItem,
string $sourceItemIdFieldName,
string $productInterfaceClassName
) {
$this->resource = $resource;
$this->metadataPool = $metadataPool;
Expand Down

0 comments on commit ab39b56

Please sign in to comment.