Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HuangStomach opened this issue Sep 21, 2018 · 3 comments
Open

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

HuangStomach opened this issue Sep 21, 2018 · 3 comments

Comments

@HuangStomach
Copy link
Contributor

其中有部分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之类来节省不必要的字段?

@iamfat
Copy link
Owner

iamfat commented Sep 22, 2018 via email

@HuangStomach
Copy link
Contributor Author

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

@HuangStomach
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants