diff --git a/vendor/magento/module-indexer/etc/di.xml b/vendor/magento/module-indexer/etc/di.xml index 482ca591811..e609f9eace9 100644 --- a/vendor/magento/module-indexer/etc/di.xml +++ b/vendor/magento/module-indexer/etc/di.xml @@ -37,6 +37,9 @@ Magento\Framework\Mview\View\CollectionInterface + + updated_at + diff --git a/app/etc/di.xml b/app/etc/di.xml index 2b55ef456fa..03179586218 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -212,6 +212,7 @@ + diff --git a/vendor/magento/framework/Mview/View/CompositeSubscriptionStatementPostprocessor.php b/vendor/magento/framework/Mview/View/CompositeSubscriptionStatementPostprocessor.php new file mode 100644 index 00000000000..ba6fdbdd2b2 --- /dev/null +++ b/vendor/magento/framework/Mview/View/CompositeSubscriptionStatementPostprocessor.php @@ -0,0 +1,36 @@ +postprocessors = $postprocessors; + } + + /** + * @inheritdoc + */ + public function process(string $tableName, string $event, string $statement): string + { + foreach ($this->postprocessors as $postprocessor) { + $statement = $postprocessor->process($tableName, $event, $statement); + } + + return $statement; + } +} diff --git a/vendor/magento/framework/Mview/View/Subscription.php b/vendor/magento/framework/Mview/View/Subscription.php index 933d075..c6c6578 100644 --- a/vendor/magento/framework/Mview/View/Subscription.php +++ b/vendor/magento/framework/Mview/View/Subscription.php @@ -92,6 +92,11 @@ class Subscription implements SubscriptionInterface, SubscriptionTriggersInterfa */ private $triggers = []; + /** + * @var SubscriptionStatementPostprocessorInterface + */ + private $statementPostprocessor; + /** * @param ResourceConnection $resource * @param TriggerFactory $triggerFactory @@ -102,6 +107,8 @@ class Subscription implements SubscriptionInterface, SubscriptionTriggersInterfa * @param array $ignoredUpdateColumns * @param array $ignoredUpdateColumnsBySubscription * @param Config|null $mviewConfig + * @param SubscriptionStatementPostprocessorInterface|null $statementPostprocessor + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( ResourceConnection $resource, @@ -112,7 +119,8 @@ class Subscription implements SubscriptionInterface, SubscriptionTriggersInterfa $columnName, $ignoredUpdateColumns = [], $ignoredUpdateColumnsBySubscription = [], - Config $mviewConfig = null + ?Config $mviewConfig = null, + ?SubscriptionStatementPostprocessorInterface $statementPostprocessor = null ) { $this->connection = $resource->getConnection(); $this->triggerFactory = $triggerFactory; @@ -124,6 +132,8 @@ class Subscription implements SubscriptionInterface, SubscriptionTriggersInterfa $this->ignoredUpdateColumns = $ignoredUpdateColumns; $this->ignoredUpdateColumnsBySubscription = $ignoredUpdateColumnsBySubscription; $this->mviewConfig = $mviewConfig ?? ObjectManager::getInstance()->get(Config::class); + $this->statementPostprocessor = $statementPostprocessor + ?? ObjectManager::getInstance()->get(SubscriptionStatementPostprocessorInterface::class); } /** @@ -324,13 +334,16 @@ class Subscription implements SubscriptionInterface, SubscriptionTriggersInterfa } $columns = $this->prepareColumns($view, $event); - return sprintf( + $statement = sprintf( $trigger, $this->getProcessor()->getPreStatements(), $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), implode(', ', $columns['column_names']), implode(', ', $columns['column_values']) ); + $statement = $this->statementPostprocessor->process($this->getTableName(), $event, $statement); + + return $statement; } /** diff --git a/vendor/magento/framework/Mview/View/SubscriptionStatementPostprocessorInterface.php b/vendor/magento/framework/Mview/View/SubscriptionStatementPostprocessorInterface.php new file mode 100644 index 00000000000..288eb16f022 --- /dev/null +++ b/vendor/magento/framework/Mview/View/SubscriptionStatementPostprocessorInterface.php @@ -0,0 +1,21 @@ +