does multi insert into single query possible in Yii?

Does yii provide method in joining insert string into single query rather than using foreach method,

I mean like this

in usual mysql query with classical php

mysql_query("INSERT INTO name_table VALUES ('blablabla','blablabla','blablabla');INSERT INTO name_table VALUES ('blablabla1','blablabla1','blablabla1');INSERT INTO name_table VALUES ('blablabla2','blablabla2','blablabla2');");

using foreach

foreach($var as $somevariable) {

$model = new Model;

$model->attributes = $somevariable

if ($model->validate()) $model->save()


i have read on google that join into single query is faster than run loop insert.

Thanks in advance!

No, there is no such method so you’ll have to use Yii::app()->db->createCommand.

@samdark. Thx for instruction, now its work