gini icon indicating copy to clipboard operation
gini copied to clipboard

是否可以增加不必须带有id和extra属性的功能?

Open HuangStomach opened this issue 6 years ago • 3 comments

其中有部分ORM其实是不需要extra字段和id字段 但是代码中很多地方又强依赖了这些字段比如Object的fetch方法:

    public function fetch($force = false)
    {
        if ($this->criteria() === null && $this->those) {
            //try those API
            $ids = (array) $this->those->limit(1)->get('id');
            $this->criteria(reset($ids));
        }

        return parent::fetch($force);
    }

是否可以提供一种属性值unset或者另一个可供继承的类比如PureObject之类来节省不必要的字段?

HuangStomach avatar Sep 21 '18 15:09 HuangStomach

这个主要是要解决什么场景问题呢? 我想想看orm有没有必要完成其他类型表的对象映射

Inviato da iPhone

Il giorno 21 set 2018, alle ore 23:14, HuangJP [email protected] ha scritto:

其中有部分ORM其实是不需要extra字段和id字段 但是代码中很多地方又强依赖了这些字段比如Object的fetch方法:

public function fetch($force = false)
{
    if ($this->criteria() === null && $this->those) {
        //try those API
        $ids = (array) $this->those->limit(1)->get('id');
        $this->criteria(reset($ids));
    }

    return parent::fetch($force);
}

是否可以提供一种属性值unset或者另一个可供继承的类比如PureObject之类来节省不必要的字段?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

iamfat avatar Sep 22 '18 11:09 iamfat

好比我有一些单纯的关系 或者说我这个表是记录不需要id 因为id增长可能反而影响我的海量记录 再或这个表是要提供给第三方的关系表 orm方便维护等等

HuangStomach avatar Sep 22 '18 13:09 HuangStomach

再补充一条 比如我做统计的时候 id 和 extra 实际上是不需要的

HuangStomach avatar Nov 02 '18 08:11 HuangStomach