yii2 activerecord bulk insert

Solutions on MaxInterview for yii2 activerecord bulk insert by the best coders in the world

showing results for - "yii2 activerecord bulk insert"
Paola
13 Aug 2017
1Yii::$app->db
2->createCommand()
3->batchInsert('table_name', ['column1','column2', 'column3','column4','column5'],$data)
4->execute();
Sophia
07 Apr 2017
1// It's usually much easier to use DAO instead of ActiveRecord
2
3// table name, column names, column values
4Yii::$app->db->createCommand()->batchInsert('users', ['name', 'age'], [
5    ['Tom', 30],
6    ['Jane', 20],
7    ['Linda', 25],
8])->execute();