php - Yii relational database with not working -
i have piece of code on userscontroller
$usermodel = users::model()->with('usersubscriptiontypes')->find(array( 'order'=>'usersubscriptiontypes.idusersubscriptiontype desc', 'limit'=>1, 'condition'=>'t.paypal_profile_id=:paypal_profile_id', 'params'=>array(':paypal_profile_id'=>'i-s09aafclhh57') ));
this giving me error:
cdbcommand failed execute sql statement: sqlstate[42s22]: column not found: 1054 unknown column 'usersubscriptiontypes.idusersubscriptiontype' in 'order clause'. sql statement executed was: select `t`.`iduser` `t0_c0`, `t`.`username` `t0_c1`, `t`.`password` `t0_c2`, `t`.`email_address` `t0_c3`, `t`.`firstname` `t0_c4`, `t`.`lastname` `t0_c5`, `t`.`isadmin` `t0_c6`, `t`.`paypal_profile_id` `t0_c7`, `t`.`date_created` `t0_c8` `users` `t` (t.paypal_profile_id=:paypal_profile_id) order usersubscriptiontypes.idusersubscriptiontype desc limit 1
it seems with
not working basing on sql code snippet error gave.
this users.php
relations model code:
public function relations() { // note: may need adjust relation name , related // class name relations automatically generated below. return array( 'trackeditems' => array(self::has_many, 'trackeditems', 'iduser'), 'usersubscriptiontypes' => array(self::has_many, 'usersubscriptiontype', 'iduser'), ); }
what wrong one? , ideas?
thanks!
Comments
Post a Comment