Answers for "yii2 activerecord bulk insert"

PHP
0

activerecord batch insert in yii2

Yii::$app->db
->createCommand()
->batchInsert('table_name', ['column1','column2', 'column3','column4','column5'],$data)
->execute();
Posted by: Guest on September-16-2020
0

yii2 activerecord bulk insert

// It's usually much easier to use DAO instead of ActiveRecord

// table name, column names, column values
Yii::$app->db->createCommand()->batchInsert('users', ['name', 'age'], [
    ['Tom', 30],
    ['Jane', 20],
    ['Linda', 25],
])->execute();
Posted by: Guest on September-10-2020

Browse Popular Code Answers by Language