| @@ 113-121 (lines=9) @@ | ||
| 110 | /** |
|
| 111 | * @return \yii\db\ActiveQuery |
|
| 112 | */ |
|
| 113 | public function getParent() |
|
| 114 | { |
|
| 115 | $tableName = $this->owner->tableName(); |
|
| 116 | $query = $this->getParents(1) |
|
| 117 | ->orderBy(["{$tableName}.[[{$this->leftAttribute}]]" => SORT_DESC]) |
|
| 118 | ->limit(1); |
|
| 119 | $query->multiple = false; |
|
| 120 | return $query; |
|
| 121 | } |
|
| 122 | ||
| 123 | /** |
|
| 124 | * @return \yii\db\ActiveQuery |
|
| @@ 126-135 (lines=10) @@ | ||
| 123 | /** |
|
| 124 | * @return \yii\db\ActiveQuery |
|
| 125 | */ |
|
| 126 | public function getRoot() |
|
| 127 | { |
|
| 128 | $tableName = $this->owner->tableName(); |
|
| 129 | $query = $this->owner->find() |
|
| 130 | ->andWhere(["{$tableName}.[[{$this->leftAttribute}]]" => 1]) |
|
| 131 | ->andWhere($this->treeCondition()) |
|
| 132 | ->limit(1); |
|
| 133 | $query->multiple = false; |
|
| 134 | return $query; |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * @param int|null $depth |
|