Hi,
I m new to YII.
I have created tables department and Employee where departmentId is foreign key in employee.
I have relation in Employee :
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'department' => array(self::BELONGS_TO, 'Department', 'departmentId'),
);
}
And In Department:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'employees' => array(self::HAS_MANY, 'Employee', 'departmentId'),
);
}
I have created both using GII tool.
In User Create _from i have department id as text field , I want drop down of department
How can i create drop down of department ?
Is there any way that drop down generated automatically while creating model/crud-generator using foreign key relation from table in mysql?