Say I have a very simple model that looks like this:
class Model_Person extends ORM
{
/*
CREATE TABLE `persons` (
`id` INT PRIMARY KEY AUTO_INCREMENT,
`firstname` VARCHAR(45) NOT NULL,
`lastname` VARCHAR(45) NOT NULL,
`date_of_birth` DATE NOT NULL,
);
*/
}
Is there a way I can I add sort of a pretend property with the full name?
So that I for example could do this:
$person = ORM::factory('person', 7);
echo $person->fullname;
instead of this:
$person = ORM::factory('person', 7);
echo $person->firstname.' '.$person->lastname;
Another example could be an is_young
property that would calculate the persons age and return true if the age was below a certain number.