I have a model defined as follows:
class User extends ActiveRecord\Model {
function get_name() {
return $this->first_name . " " . $this->surname;
}
}
however when I show $item->attributes(); then name doesn’t appear. Am I being an idiot here? If so, how do I get my custom attributes into the model?
Thanks,
Gareth
Here’s my simple solution. I’ve overriding the attributes method and adding any methods that start with “get_attribute_” so I can use them during serialization:
The resulting models that use this would look like this:
This way I can manually tack on the loginSessionId (or whatever else I want) and have it show up in the serialized values.