For example
/**
* removes an association between the project, the user and the
user's role within the project
*/
public function removeUserFromRole($role, $userId)
{
$sql = "DELETE FROM tbl_project_user_role WHERE project_
id=:projectId AND user_id=:userId AND role=:role";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":projectId", $this->id, PDO::PARAM_INT);
$command->bindValue(":userId", $userId, PDO::PARAM_INT);
$command->bindValue(":role", $role, PDO::PARAM_STR);
return $command->execute();
}Now, why would they start mixing SQL status, and use the Yii::app()->db->functions.
I mean wouldn't it be better to completely keep SQL statements out of your code with the Yii automated codes? For example - Wouldn't it be better to create a Controller for the new tbl_project_user_role and use actionCreate, actionDelete, actionUpdate auto-generated methods to interact with that database?
Why the sudden change to specific SQL querys? Is it just simpler to explain or there is a OOP approach I am not understanding here?

Help











