我有一个具有计算字段的模型。返回的值始终为 1。打开调试后,查询中硬编码为 1:
<?php class Model_Income extends Model_base_Income {
function init(){
parent::init();
$this->debug();
$this->addField('year')->calculated(true);
}
function calculate_year(){
return '22';
}
}
调试返回的查询
select `name`
,(select `name` from `client` where `income`.`client_id` = `client`.`id` )
`client`,`amount`,`date`,`comment`,1 `year`,`id`
from `income`
我正在使用 atk 4.2