For example I have a model Person that was created from db table 'person' with fields 'firstname' and 'lastname' using Gii model generator. I can access these attributes like
$person = Person::findOne($PersonId);
$personFirstname = $person->firstname;
If i created custom attribute fullname
using getters and setters:
public function getFullname()
{
return $this->firstname .' '.$this->lastname
}
I don't need 'firstname' and 'lastname' anymore. I i would like to hide them. Make private. How can I do that?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.