I’m trying to get data with model but it’s querying SQL with conditions which are not called. I couldn’t solve this, i dont know where it is adding this conditions. Any help would be nice Thank you…
[14:54:31.310][trace][system.db.CDbCommand] Querying SQL: SELECT * FROM “medicine_drug_update” “t” WHERE (b[/b] AND (user_changed=:ycp1)) AND b[/b] ORDER BY id DESC LIMIT 10. Bound with :ycp0=‘1’, :ycp1=‘1’, :ycp2=‘1’ in D:\wamp\www\vademecum_admin\protected\views\moderate\myrecords.php (33) in D:\wamp\www\vademecum_admin\protected\controllers\ModerateController.php (60) in D:\wamp\www\vademecum_admin\index.php (13)
myrecords (satır 116)
seperating where clause as (unwanted&&mycondition) && unwanted
[b]AND (status=:ycp2)[/b]
[b](in_book=:ycp0)[/b]
public function actionMyRecords()
{
$this->layout='//layouts/column2';
$model= new DrugUpdate;
$model->user_changed = Yii::app()->user->getId();
$this->render('myrecords', array(
"model" => $model
));
}
Columns in_book and status probably have default values (different than NULL) in your database schema. When a new instance of DrugUpdate gets created its corresponding attributes will have that default values too, and DrugUpdate::search() will filter the result by that attributes.