Skip to content

Commit 810402b

Browse files
ACPT-773: Fixing insertOnDuplicate doesn't use array keys for columns like insertMultiple
1 parent 349c081 commit 810402b

File tree

1 file changed

+5
-1
lines changed
  • lib/internal/Magento/Framework/DB/Adapter/Pdo

1 file changed

+5
-1
lines changed

lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,11 @@ public function insertOnDuplicate($table, array $data, array $fields = [])
19941994
if (array_diff($cols, array_keys($row))) {
19951995
throw new \Zend_Db_Exception('Invalid data for insert');
19961996
}
1997-
$values[] = $this->_prepareInsertData($row, $bind);
1997+
$line = [];
1998+
foreach ($cols as $field) {
1999+
$line[] = $row[$field];
2000+
}
2001+
$values[] = $this->_prepareInsertData($line, $bind);
19982002
}
19992003
unset($row);
20002004
} else { // Column-value pairs

0 commit comments

Comments
 (0)