1
0
Fork 0
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:
Alexander Kochetov 2013-05-07 15:10:05 +04:00
parent 24a7a1f022
commit b3afecbe73

View file

@ -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;
}
}