mirror of
https://github.com/Oreolek/yii2-nested-sets.git
synced 2024-07-01 05:55:00 +03:00
NestedSetQuery fix
This commit is contained in:
parent
24a7a1f022
commit
b3afecbe73
|
@ -27,14 +27,15 @@ class NestedSetQuery extends Behavior
|
|||
public $levelAttribute = 'level';
|
||||
|
||||
/**
|
||||
* Named scope. Gets root node(s).
|
||||
* @param ActiveQuery $query.
|
||||
* Gets root node(s).
|
||||
* @return ActiveRecord the owner.
|
||||
*/
|
||||
public function roots($query)
|
||||
public function roots()
|
||||
{
|
||||
/** @var $modelClass ActiveRecord */
|
||||
$modelClass=$this->owner->modelClass;
|
||||
$query->andWhere($modelClass::getDb()->quoteColumnName($this->leftAttribute) . '=1');
|
||||
$this->owner->andWhere($modelClass::getDb()->quoteColumnName($this->leftAttribute) . '=1');
|
||||
|
||||
return $this->owner;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue