开发者

How to define new Model in ATK4

From: http://agiletoolkit.org/learn/understand/model/add

class Model_MyModel extends Model_Table {

    function init(){
        parent::init();
        $this->addField('name');
    }
}

Fr开发者_JAVA百科om: http://agiletoolkit.org/intro/models

class Model_MyModel extends Model_Table {

    function defineFields(){
        parent::defineFields();
        $this->addField('name');
    }
}

Which is correct? What's the difference?


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


using the init() method is the right one. defineField is old way and was changed in favor of "init" due to consistency.

I will update the pages accordingly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜