public createCommand ( |
||
$db | the database connection used to generate the SQL statement. If this parameter is not given, the `db` application component will be used. | |
return | the created DB command instance. |
public function createCommand($db = null)
{
if ($db === null) {
$db = Yii::$app->getDb();
}
list($sql, $params) = $db->getQueryBuilder()->build($this);
return $db->createCommand($sql, $params);
}
/** * Perform the DB Query * * @return array */ public function perform() { // Create the command $command = $this->query->createCommand(); // Execute the command and return return $command->queryAll(); }