I want to run a prepared query in Yii using createCommand, but get results as models instead of associative arrays.
class Fruit extends ActiveRecord {
public function eat() {return this;};
}
// This will be an extremely complicated query so I need
// to write it raw without any kind of query builder
$rows = Yii::$app->db->createCommand('SELECT * FROM fruits WHERE color = :color')
->bindValue('color', 'blue')->queryAll();
$fruits = magicallyTurnIntoFruit($rows);
$fruits[0]->eat()->save();
How do accomplish this?