1 | <?php |
||
17 | class RecursiveQuery implements RecursiveQueryInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var string The table in which hierarchical data is stored |
||
21 | */ |
||
22 | protected $hierarchyTable; |
||
23 | |||
24 | /** |
||
25 | * This Class handles recusive queries to retrieve |
||
26 | * parent-child relations for terms. |
||
27 | */ |
||
28 | 105 | public function __construct() |
|
32 | |||
33 | /** |
||
34 | * Get all ancestors of a term |
||
35 | * |
||
36 | * @param int $id The term ID |
||
37 | * @return \Illuminate\Support\Collection |
||
38 | */ |
||
39 | 27 | public function getAncestry($id) |
|
49 | |||
50 | /** |
||
51 | * Get the query to initiate the recursive query. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | 57 | protected function getAncestryInitialQuery() |
|
59 | |||
60 | /** |
||
61 | * Get the ancestry recursively |
||
62 | * |
||
63 | * @param Collection $all_results |
||
64 | * @param int[] $ids |
||
65 | */ |
||
66 | 20 | protected function getRecursiveAncestry(Collection $all_results, $ids) |
|
74 | |||
75 | /** |
||
76 | * Get all descendants of a term. |
||
77 | * |
||
78 | * @param int $id The term ID |
||
79 | * @return \Illuminate\Support\Collection |
||
80 | */ |
||
81 | 27 | public function getDescent($id) |
|
91 | |||
92 | /** |
||
93 | * Get the query to initiate the recursive query. |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | 57 | protected function getDescentInitialQuery() |
|
101 | |||
102 | /** |
||
103 | * Get the descent recursively. |
||
104 | * |
||
105 | * @param Collection $all_results |
||
106 | * @param int[] $ids |
||
107 | */ |
||
108 | 17 | protected function getRecursiveDescent(Collection $all_results, $ids) |
|
116 | } |
||
117 |