Reputation: 511
I have following code in my StudentsForm model:
public function attributeLabels()
{
return array(
'id' => 'ID',
'sname' => 'Name',
'fill' => ' Date',
);
}
and in my TeacherForm in my model:
public function attributeLabels()
{
return array(
'id' => 'ID',
'tname' => ' Teacher Name',
'fill' => ' Date',
);
}
How can I call attributeLabels() of StudentsForm in TeachersForm. Both models are located in one model
Upvotes: 1
Views: 1120
Reputation: 507
you can try this by 2 methods.
First method.
$studentLable = StudentsForm::model()->attributeLabels();
Second method.
$studentModel = new StudentsForm;
$studentLable = $studentModel->attributeLabels();
Upvotes: 1
Reputation: 7294
Simply use this
$lables = StudentsForm::model()->attributeLabels();
$lables
will be an array
$lables = array(
'id' => 'ID',
'sname' => 'Name',
'fill' => ' Date',
);
Upvotes: 1