activerecord batch insert in yii2

To perform a batch insert in Yii2's ActiveRecord, you can use the batchInsert() method. Here's an example of how to use it:

$data = [
    ['column1' => 'value1', 'column2' => 'value2'],
    ['column1' => 'value3', 'column2' => 'value4'],
    // add more data rows as needed
];

Yii::$app->db->createCommand()->batchInsert('tableName', ['column1', 'column2'], $data)->execute();

In the example above, tableName should be replaced with the actual name of the table you want to insert into. The ['column1', 'column2'] array specifies the columns that you want to insert data into. The $data array contains the data rows to be inserted.

Make sure to adjust the column names and data according to your specific needs.