Browse Source

Clean usage of Trait variant

tags/v1.0.1
PaulZi 10 years ago
parent
commit
11068186c0
  1. 9
      NestedSetsQueryTrait.php

9
NestedSetsQueryTrait.php

@ -19,12 +19,7 @@ trait NestedSetsQueryTrait
{
/** @var \yii\db\ActiveQuery $this */
$class = $this->modelClass;
if (isset($class::$nestedSetsLeftAttribute)) {
return $this->andWhere([$class::$nestedSetsLeftAttribute => 1]);
} else {
/** @var \yii\db\ActiveRecord|NestedSetsBehavior $model */
$model = new $class;
return $this->andWhere([$model->leftAttribute => 1]);
}
$model = new $class;
return $this->andWhere([$model->leftAttribute => 1]);
}
}

Loading…
Cancel
Save