Hello.
Can you comment, please, is this secure code?
$userid=Yii::app()->user->id;
$sqlCommand = "SELECT mail FROM user WHERE id = ".$userid." ";
$this = Yii::app()->db->createCommand($sqlCommand)->queryScalar();
Or I can more secure connect to DB directly?