Skip to content

New methods for ActiveQuery #75

@pentiumd2015

Description

@pentiumd2015
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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions