0
Q:

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();
0

New to Communities?

Join the community