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

New methods for ActiveQuery #75

Open
pentiumd2015 opened this issue Aug 21, 2019 · 1 comment
Open

New methods for ActiveQuery #75

pentiumd2015 opened this issue Aug 21, 2019 · 1 comment
Labels
type:enhancement Enhancement

Comments

@pentiumd2015
Copy link

pentiumd2015 commented Aug 21, 2019

public function resetWith()
    {
        $this->with = [];

        if($this->joinWith){
            foreach($this->joinWith AS &$join){
                $join[1] = false;
            }

            unset($join);
        }

        return $this;
    }

Также метод, позволяющий просмотреть весь запрос, который будет выполнен:

public function getRawSql()
    {
        $builder = Yii::$app->db->queryBuilder;

        $query = clone $this;
        $query->resetWith();

        return $query->prepare($builder)->createCommand()->rawSql;
    }

Main point is to clean up eager loading or else there will be the same errors about keys.

Can we add these methods to the new version?

@samdark samdark transferred this issue from yiisoft/yii2 Aug 21, 2019
@samdark samdark changed the title Новые методы для ActiveQuery New methods for ActiveQuery Aug 21, 2019
@samdark
Copy link
Member

samdark commented Aug 21, 2019

@pentiumd2015 translated. Please try using English next time. While Russian is my native language, many people in community can not read it.

As for the feature, it will be considered for Yii 3 if we'll decide to continue developing our own database abstraction layer.

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

No branches or pull requests

2 participants