Skip to content

Commit 6071c5a

Browse files
committed
Mview patch update
1 parent a77c41c commit 6071c5a

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

lib/internal/Magento/Framework/Mview/View.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ private function executeAction(ActionInterface $action, int $lastVersionId, int
313313
'view_id' => $this->changelog->getViewId()
314314
];
315315
$ids = $this->strategies[$this->changelog->getViewId()]->walk($changelogData, $vsFrom, $batchSize);
316+
$vsFrom += $batchSize;
316317
$action->execute($ids);
317318
} else {
318319
$ids = $this->getBatchOfIds($vsFrom, $currentVersionId);

lib/internal/Magento/Framework/Mview/View/Changelog.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function create()
117117
self::ATTRIBUTE_COLUMN,
118118
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
119119
null,
120-
['unsigned' => true, 'nullable' => false, 'default' => '0'],
120+
['unsigned' => true, 'nullable' => true],
121121
'Attribute ID'
122122
);
123123
}
@@ -126,7 +126,7 @@ public function create()
126126
self::STORE_COLUMN,
127127
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
128128
null,
129-
['unsigned' => true, 'nullable' => false, 'default' => '0'],
129+
['unsigned' => true, 'nullable' => true],
130130
'Store ID'
131131
);
132132
}

lib/internal/Magento/Framework/Mview/View/Subscription.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,15 @@ protected function buildStatement($event, $changelog)
242242
);
243243
}
244244

245+
/**
246+
* @param string $prefix
247+
* @return string
248+
*/
249+
public function getEntityColumn(string $prefix): string
250+
{
251+
return $prefix . $this->connection->quoteIdentifier($this->getColumnName());
252+
}
253+
245254
/**
246255
* Prepare column names and column values for trigger body
247256
*
@@ -256,19 +265,26 @@ public function prepareTriggerBody(ChangelogInterface $changelog, string $eventT
256265
$this->connection->describeTable($this->getTableName()),
257266
'COLUMN_NAME'
258267
);
268+
$describedClColumns = array_column(
269+
$this->connection->describeTable($changelog->getName()),
270+
'COLUMN_NAME'
271+
);
259272
$viewConfig = $this->mviewConfig->getView($this->getView()->getId());
260273
$columnNames = [$this->connection->quoteIdentifier($changelog->getColumnName())];
261-
$columnValues = [$this->connection->quoteIdentifier($this->getColumnName())];
274+
$columnValues = [$this->getEntityColumn($prefix)];
262275
//If we need to add attributes
263276
if ($viewConfig[ChangelogInterface::ATTRIBUTE_SCOPE_SUPPORT] &&
264-
array_search(Changelog::ATTRIBUTE_COLUMN, $describedSubscribedColumns)
277+
array_search(Changelog::ATTRIBUTE_COLUMN, $describedSubscribedColumns) &&
278+
array_search(Changelog::ATTRIBUTE_COLUMN, $describedClColumns)
279+
265280
) {
266281
$columnValues[] = $prefix . $this->connection->quoteIdentifier(Changelog::ATTRIBUTE_COLUMN);
267282
$columnNames[] = $this->connection->quoteIdentifier(Changelog::ATTRIBUTE_COLUMN);
268283
}
269284
//If we need to add stores
270285
if ($viewConfig[ChangelogInterface::STORE_SCOPE_SUPPORT] &&
271-
array_search(Changelog::STORE_COLUMN, $describedSubscribedColumns)
286+
array_search(Changelog::STORE_COLUMN, $describedSubscribedColumns) &&
287+
array_search(Changelog::STORE_COLUMN, $describedClColumns)
272288
) {
273289
$columnValues[] = $prefix . $this->connection->quoteIdentifier(Changelog::STORE_COLUMN);
274290
$columnNames[] = $this->connection->quoteIdentifier(Changelog::STORE_COLUMN);

0 commit comments

Comments
 (0)