Use a custom Row class:
Zend Framework: Documentation
You can override the __get method to call functions in your custom row class for properties that don't exist.
For example:
PHP Code:
//model
class User extends Zend_Db_Table_Abstract
{
protected $_name = 'user';
//use custom row class
protected $_rowClass = 'UserRow';
}
//custom row class
class UserRow extends Zend_Db_Table_Row_Abstract {
function __get($key){
if(method_exists($this, $key)){
return $this->$key();
}
return parent::__get($key);
}
function fullname(){
return $this->forename . ' ' . $this->lastname;
}
}
In the above example, you'd be able to access a fullname property of rows, even though there is no fullname column.
PHP Code:
$fullname = $row->fullname;