fishgills
(Fishgills)
1
Ok, let’s see if I can explain this correctly…
I have a CActiveRecord that has a relation to another table/class.
I’m able to use the nifty Yii features to access the related class’ properties just fine.
But the related class is based on a user table that has a column for First name and Last name.
I’d like the User class to have a “Name” property that can be used in the same fashion as the column names…
So I can access it by "createdBy.name" and have the proper labels and what not showing up in various places…
I hope this is clear enough!
zilles
(Zilles)
2
Add this to the User class:
public function getName()
{
return $this->FirstName." ".$this->LastName;
}
fishgills
(Fishgills)
3
Oh geeze. That was easy. I feel lame.
Thanks!