I have the following tables:
CREATE TABLE `User` ( `id` int(11) NOT NULL AUTO_INCREMENT, `usertypeid` int(11) NOT NULL, `username` varchar(50) NOT NULL, `password` varchar(32) NOT NULL, `entry_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `UserType` ( `id` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
In yiic shell I created the models and crud files.
In User I defined the folowing relation:
public function relations()
{
return array(
'usertypeid'=>array(self::BELONGS_TO, 'UserType', 'id'),
);
}
In UserType the following:
public function relations()
{
return array(
'user'=>array(self::HAS_MANY, 'User', 'usertypeid'),
);
}
In UserController in the actionAdmin function I have this:
$models=User::model()->with('usertypeid')->findAll();
This doesn't work however. What am I doing wrong here?

Help














