This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from DivanteLtd/feature/product-indexer-depen…
…dencies Product indexer - add dependencies.
- Loading branch information
Showing
4 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
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
57 changes: 57 additions & 0 deletions
57
src/module-vsbridge-indexer-catalog/Plugin/Mview/ViewPlugin.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,57 @@ | ||
<?php | ||
|
||
namespace Divante\VsbridgeIndexerCatalog\Plugin\Mview; | ||
|
||
use Divante\VsbridgeIndexerCatalog\Model\Indexer\ProductProcessor; | ||
use Divante\VsbridgeIndexerCatalog\Api\Data\CatalogConfigurationInterface; | ||
use Magento\Framework\Mview\ViewInterface; | ||
|
||
/** | ||
* Class ViewPlugin | ||
*/ | ||
class ViewPlugin | ||
{ | ||
/** | ||
* @var CatalogConfigurationInterface | ||
*/ | ||
private $catalogSettings; | ||
|
||
/** | ||
* ViewPlugin constructor. | ||
* | ||
* @param CatalogConfigurationInterface $catalogSettings | ||
*/ | ||
public function __construct(CatalogConfigurationInterface $catalogSettings) | ||
{ | ||
$this->catalogSettings = $catalogSettings; | ||
} | ||
|
||
/** | ||
* @param ViewInterface $subject | ||
* @param array $result | ||
* | ||
* @return array | ||
*/ | ||
public function afterGetSubscriptions(ViewInterface $subject, array $result): array | ||
{ | ||
if ($this->catalogSettings->useCatalogRules() && $this->isVsbridgeProductIndexer($subject)) { | ||
$result['catalogrule_product_price'] = [ | ||
'name' => 'catalogrule_product_price', | ||
'column' => 'product_id', | ||
'subscription_model' => null, | ||
]; | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* @param ViewInterface $subject | ||
* | ||
* @return bool | ||
*/ | ||
private function isVsbridgeProductIndexer(ViewInterface $subject): bool | ||
{ | ||
return ProductProcessor::INDEXER_ID === $subject->getId(); | ||
} | ||
} |
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