1 | <?php |
||
17 | class CommonTableExpressionQuery extends RecursiveQuery implements RecursiveQueryInterface |
||
18 | { |
||
19 | /** |
||
20 | * Execute the query with the current PDO connection. |
||
21 | * Will log the time taken manually |
||
22 | * |
||
23 | * @param string $raw_query |
||
24 | * @param int $id |
||
25 | * @return \Illuminate\Support\Collection |
||
26 | */ |
||
27 | 54 | protected function runQuery($raw_query, $id) |
|
41 | |||
42 | /** |
||
43 | * Prepare the complete query to run on the DB to get the data recursively. |
||
44 | * |
||
45 | * @param string $initial The initial query bootstrapping the recursive query |
||
46 | * @param string $recursive The query to dig deeper in the hierarchy |
||
47 | * @return string |
||
48 | */ |
||
49 | 54 | protected function assembleQuery($initial, $recursive) |
|
62 | |||
63 | /** |
||
64 | * Get all ancestors of a term |
||
65 | * |
||
66 | * @param int $id The term ID |
||
67 | * @return \Illuminate\Support\Collection |
||
68 | */ |
||
69 | 30 | public function getAncestry($id) |
|
78 | |||
79 | /** |
||
80 | * Get all descendants of a term. |
||
81 | * |
||
82 | * @param int $id The term ID |
||
83 | * @return \Illuminate\Support\Collection |
||
84 | */ |
||
85 | 30 | public function getDescent($id) |
|
94 | } |
||
95 |