In this particular case I need to write some data, coming from external file, directly to db from controller. Into a while statement i get some data and I need to put them into db. What I must use for this?
In this particular case I need to write some data, coming from external file, directly to db from controller. Into a while statement i get some data and I need to put them into db. What I must use for this?
I believe DB Command suits best to your case:
$dbCommand = \Yii::$app->db->createCommand();
$dbCommand->insert('table_name', ['column1' => 'value1', 'column2' => 'value2']);
Oh yes! And createCommand() it is well documented in the guide too, but for some reason I had missed. Thank you, it is exactly what i was looking for.