active-record
active-record copied to clipboard
New methods for ActiveQuery
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?
@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.