|
@@ 118-131 (lines=14) @@
|
| 115 |
|
* @return int|false : the number of entities or false on failure |
| 116 |
|
*/ |
| 117 |
|
|
| 118 |
|
public function getSubtreeCount(int $parent_id = 0) { |
| 119 |
|
|
| 120 |
|
if (!(static::$nesting && ($parent_id >= 0))) return false; |
| 121 |
|
|
| 122 |
|
# Get count |
| 123 |
|
|
| 124 |
|
$query = $this->getCountQuery($parent_id); |
| 125 |
|
|
| 126 |
|
if (!(DB::send($query) && DB::getLast()->status)) return false; |
| 127 |
|
|
| 128 |
|
# ------------------------ |
| 129 |
|
|
| 130 |
|
return intval(DB::getLast()->getRow()['count']); |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
/** |
| 134 |
|
* Get the subtree depth |
|
@@ 141-154 (lines=14) @@
|
| 138 |
|
* @return int|false : the depth or false on failure |
| 139 |
|
*/ |
| 140 |
|
|
| 141 |
|
public function getSubtreeDepth(int $parent_id = 0) { |
| 142 |
|
|
| 143 |
|
if (!(static::$nesting && ($parent_id >= 0))) return false; |
| 144 |
|
|
| 145 |
|
# Get depth |
| 146 |
|
|
| 147 |
|
$query = $this->getDepthQuery($parent_id); |
| 148 |
|
|
| 149 |
|
if (!(DB::send($query) && DB::getLast()->status)) return false; |
| 150 |
|
|
| 151 |
|
# ------------------------ |
| 152 |
|
|
| 153 |
|
return intval(DB::getLast()->getRow()['depth']); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
/** |
| 157 |
|
* Get the entity path |