findByAttributes misbehavior


$user=Account::model()->findByAttributes(array('name'=>$username));

generates


SELECT * FROM `Account` WHERE `Account`.`name`=:yp0 LIMIT 1

I confirmed the existense of $username. It seems impossible to debug without touching CActiveRecord.

Any suggestions, please?

Ticket created.

In your db connection config, you can set ‘enableParamLogging’=>true to turn on parameter logging.




2009/08/14 20:59:04 [trace] [system.db.CDbCommand] Querying SQL: SELECT * FROM `Account` WHERE `Account`.`name`=:yp0 LIMIT 1. Bind with parameter :yp0='pestaa'



Edit:

Please forgive my stupidity, I was in the misbelief that the generated SQL that was sent to firebug was also sent to the database.

I see my mistake now. Sorry for any inconvenience.

$model=OasisRiskAssessment::model()->findByAttributes(array(‘patient_id’=>$_REQUEST[‘id’]));

is i get model with patient_id equal to $_REQUEST[‘id’] ???

Yep,

You can also use FindByPK if id is your primary key