Another question from newbie. Actually I have working solution already in my hands but I'm just double checking this because Yii is soo automated
So, I have listbox which data comes from anothel Model. Table structure is ID and ITEM. So every item has unique ID. Now I'd like to insert ID to another table, it depends what user chooses right? My code:
public function BeforeSave() {
if(parent::beforeSave()) {
$rolename = Role::model()->findByAttributes(array('name'=>$this->roleid));
if($rolename === null) {
//for firebug hackers
redirect(array('user/create'));
}
$this->roleid = $rolename->id;
...
}
Maybe there is any better solution for that or no?
Thanks.

Help












