@@ -24,7 +24,7 @@ protected function setClosureTable($table)
24
24
25
25
public function createInitialClosure ()
26
26
{
27
- $ query = new Query (static ::$ dbconnection );
27
+ $ query = new Query (static ::getConnection () );
28
28
$ query ->sql (QueryBuilder::insert ($ this ->closureTable , ['parent_id ' => $ this ->id , 'child_id ' => $ this ->id , 'depth ' => 0 ]));
29
29
$ query ->execute ();
30
30
}
@@ -33,7 +33,7 @@ public function addParent(self $parent)
33
33
{
34
34
$ table = $ this ->closureTable ;
35
35
36
- $ query = new Query (static ::$ dbconnection );
36
+ $ query = new Query (static ::getConnection () );
37
37
$ query ->sql ("
38
38
INSERT INTO $ table (parent_id, child_id, depth)
39
39
SELECT p.parent_id, c.child_id, p.depth+c.depth+1
@@ -47,7 +47,7 @@ public function removeParent(self $parent)
47
47
{
48
48
$ table = $ this ->closureTable ;
49
49
50
- $ query = new Query (static ::$ dbconnection );
50
+ $ query = new Query (static ::getConnection () );
51
51
$ query ->sql ("
52
52
DELETE FROM $ table WHERE id IN(
53
53
SELECT a.id FROM (
@@ -68,7 +68,7 @@ public function changeParent(self $oldparent, self $newparent)
68
68
69
69
public function _property_parents ()
70
70
{
71
- $ query = new Query (static ::$ dbconnection );
71
+ $ query = new Query (static ::getConnection () );
72
72
$ query ->sql (
73
73
QueryBuilder::select ($ this ->closureTable , ['parent_id ' ])->where (['child_id ' => $ this ->id , 'depth ' => 1 ])
74
74
);
@@ -82,7 +82,7 @@ public function _property_parents()
82
82
83
83
public function _property_children ()
84
84
{
85
- $ query = new Query (static ::$ dbconnection );
85
+ $ query = new Query (static ::getConnection () );
86
86
$ query ->sql (
87
87
QueryBuilder::select ($ this ->closureTable , ['child_id ' ])->where (['parent_id ' => $ this ->id , 'depth ' => 1 ])
88
88
);
0 commit comments