|
@@ 89-102 (lines=14) @@
|
| 86 |
|
|
| 87 |
|
# Get subtree count |
| 88 |
|
|
| 89 |
|
public function subtreeCount(int $parent_id = 0) { |
| 90 |
|
|
| 91 |
|
if (!(static::$nesting && ($parent_id >= 0))) return false; |
| 92 |
|
|
| 93 |
|
# Get count |
| 94 |
|
|
| 95 |
|
$query = $this->getCountQuery($parent_id); |
| 96 |
|
|
| 97 |
|
if (!(DB::send($query) && DB::last()->status)) return false; |
| 98 |
|
|
| 99 |
|
# ------------------------ |
| 100 |
|
|
| 101 |
|
return intval(DB::last()->row()['count']); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
# Get subtree depth |
| 105 |
|
|
|
@@ 106-119 (lines=14) @@
|
| 103 |
|
|
| 104 |
|
# Get subtree depth |
| 105 |
|
|
| 106 |
|
public function subtreeDepth(int $parent_id = 0) { |
| 107 |
|
|
| 108 |
|
if (!(static::$nesting && ($parent_id >= 0))) return false; |
| 109 |
|
|
| 110 |
|
# Get depth |
| 111 |
|
|
| 112 |
|
$query = $this->getDepthQuery($parent_id); |
| 113 |
|
|
| 114 |
|
if (!(DB::send($query) && DB::last()->status)) return false; |
| 115 |
|
|
| 116 |
|
# ------------------------ |
| 117 |
|
|
| 118 |
|
return intval(DB::last()->row()['depth']); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
# Get path |
| 122 |
|
|