/** * Magic getter * * @param string $key */ public function __get($key) { $value = parent::__get($key); if ($key == 'data') { $value = is_null($value) ? null : json_decode($value, true); } return $value; }
public function __get($key) { if ($key == 'author') { return ORM::factory('user')->find_user($this->author_id); } else { return parent::__get($key); } }