I have a model that has a calculated field. The value returned is always 1. After turning the debug on, 1 is hardcoded in the query:
<?php class Model_Income extends Model_base_Income {
function init(){
parent::init();
$this->debug();
$this->addField('year')->calculated(true);
}
function calculate_year(){
return '22';
}
}
Query returned by debug
select `name`
,(select `name` from `client` where `income`.`client_id` = `client`.`id` )
`client`,`amount`,`date`,`comment`,1 `year`,`id`
from `income`
I am using atk 4.2