来自:http://agiletoolkit.org/learn/understand/model/add
class Model_MyModel extends Model_Table {
function init(){
parent::init();
$this->addField('name');
}
}
来自:http://agiletoolkit.org/intro/models
class Model_MyModel extends Model_Table {
function defineFields(){
parent::defineFields();
$this->addField('name');
}
}
哪个是正确的?有什么区别?
最佳答案
Agile Data has been refactored into a separate framework: http://git.io/ad
The up-to-date way for defining the model is documented here: http://agile-data.readthedocs.io/en/develop/model.html
使用 init() 方法是正确的。 DefineField 是旧方法,由于一致性而被更改为支持“init”。
我将相应地更新页面。
关于php - 如何在ATK4中定义新模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7585289/