-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed duplicated ids to index by mview changelog
- Loading branch information
1 parent
c130c2d
commit 6eb1890
Showing
14 changed files
with
497 additions
and
83 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
app/code/Magento/Eav/Model/Mview/ChangeLogBatchWalker/IdsFetcher.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Eav\Model\Mview\ChangeLogBatchWalker; | ||
|
||
use Magento\Framework\App\ResourceConnection; | ||
use Magento\Framework\DB\Select; | ||
use Magento\Framework\Mview\View\ChangeLogBatchWalker\IdsFetcherInterface; | ||
|
||
class IdsFetcher implements IdsFetcherInterface | ||
{ | ||
/** | ||
* @var \Magento\Framework\App\ResourceConnection | ||
*/ | ||
private ResourceConnection $resourceConnection; | ||
|
||
/** | ||
* @param \Magento\Framework\App\ResourceConnection $resourceConnection | ||
*/ | ||
public function __construct( | ||
ResourceConnection $resourceConnection | ||
) { | ||
$this->resourceConnection = $resourceConnection; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function fetch(Select $select): array | ||
{ | ||
return $this->resourceConnection->getConnection()->fetchAll($select); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/code/Magento/Eav/Model/Mview/ChangeLogBatchWalker/IdsTableBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Eav\Model\Mview\ChangeLogBatchWalker; | ||
|
||
use Magento\Framework\DB\Adapter\AdapterInterface; | ||
use Magento\Framework\DB\Ddl\Table; | ||
use Magento\Framework\Mview\View\ChangeLogBatchWalker\IdsTableBuilder as BaseIdsTableBuilder; | ||
use Magento\Framework\Mview\View\ChangelogInterface; | ||
|
||
class IdsTableBuilder extends BaseIdsTableBuilder | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function build(ChangelogInterface $changelog): Table | ||
{ | ||
$table = parent::build($changelog); | ||
$table->addColumn( | ||
'attribute_ids', | ||
Table::TYPE_TEXT, | ||
null, | ||
['unsigned' => true, 'nullable' => false], | ||
'Attribute IDs' | ||
); | ||
$table->addColumn( | ||
'store_id', | ||
Table::TYPE_INTEGER, | ||
null, | ||
['unsigned' => true, 'nullable' => false], | ||
'Store ID' | ||
); | ||
$table->addIndex( | ||
self::INDEX_NAME_UNIQUE, | ||
[ | ||
$changelog->getColumnName(), | ||
'attribute_ids', | ||
'store_id' | ||
], | ||
[ | ||
'type' => AdapterInterface::INDEX_TYPE_UNIQUE | ||
] | ||
); | ||
|
||
return $table; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.