Skip to content

Commit

Permalink
[task] #91. Fix IndexHandler Contract in the Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
maghamed committed Oct 1, 2017
1 parent 3ae2cc3 commit 5b0be00
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/code/Magento/Inventory/Indexer/StockItem/IndexHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,21 @@ public function __construct(
/**
* @inheritdoc
*/
public function saveIndex(IndexName $indexName, \Traversable $documents)
public function saveIndex(IndexName $indexName, \Traversable $documents, string $connectionName)
{
$connection = $this->resourceConnection->getConnection($connectionName);
$tableName = $this->indexNameResolver->resolveName($indexName);

$columns = [IndexStructure::SKU, IndexStructure::QUANTITY];
foreach ($this->batch->getItems($documents, $this->batchSize) as $batchDocuments) {
$this->resourceConnection
->getConnection()
->insertArray($tableName, $columns, $batchDocuments);
$connection->insertArray($tableName, $columns, $batchDocuments);
}
}

/**
* @inheritdoc
*/
public function cleanIndex(IndexName $indexName, \Traversable $documents, $connectionName)
public function cleanIndex(IndexName $indexName, \Traversable $documents, string $connectionName)
{
$connection = $this->resourceConnection->getConnection($connectionName);
$tableName = $this->indexNameResolver->resolveName($indexName);
Expand Down

0 comments on commit 5b0be00

Please sign in to comment.