Hello,
I saw this piece of code online and presume it is for Yii(1). How could I do this in Yii2?
In essence, I would like to add the "ON DUPLICATE KEY UPDATE" command to the Yii batchInsert() function.
Many thanks
class MyQueryBuilder extends yii\db\mysql\QueryBuilder
{
public function batchInsert($table, $columns, $rows)
{
$sql = parent::batchInsert($table, $columns, $rows);
$sql .= 'ON DUPLICATE KEY UPDATE';
return $sql;
}
}