Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit 7641a71

Browse files
author
Nik Barham
committed
Fix ClosureTree to use static::getConnection() instead of static::$dbconnection
1 parent 2363e44 commit 7641a71

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Automatorm/Orm/Traits/ClosureTree.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function setClosureTable($table)
2424

2525
public function createInitialClosure()
2626
{
27-
$query = new Query(static::$dbconnection);
27+
$query = new Query(static::getConnection());
2828
$query->sql(QueryBuilder::insert($this->closureTable, ['parent_id' => $this->id, 'child_id' => $this->id, 'depth' => 0]));
2929
$query->execute();
3030
}
@@ -33,7 +33,7 @@ public function addParent(self $parent)
3333
{
3434
$table = $this->closureTable;
3535

36-
$query = new Query(static::$dbconnection);
36+
$query = new Query(static::getConnection());
3737
$query->sql("
3838
INSERT INTO $table (parent_id, child_id, depth)
3939
SELECT p.parent_id, c.child_id, p.depth+c.depth+1
@@ -47,7 +47,7 @@ public function removeParent(self $parent)
4747
{
4848
$table = $this->closureTable;
4949

50-
$query = new Query(static::$dbconnection);
50+
$query = new Query(static::getConnection());
5151
$query->sql("
5252
DELETE FROM $table WHERE id IN(
5353
SELECT a.id FROM (
@@ -68,7 +68,7 @@ public function changeParent(self $oldparent, self $newparent)
6868

6969
public function _property_parents()
7070
{
71-
$query = new Query(static::$dbconnection);
71+
$query = new Query(static::getConnection());
7272
$query->sql(
7373
QueryBuilder::select($this->closureTable, ['parent_id'])->where(['child_id' => $this->id, 'depth' => 1])
7474
);
@@ -82,7 +82,7 @@ public function _property_parents()
8282

8383
public function _property_children()
8484
{
85-
$query = new Query(static::$dbconnection);
85+
$query = new Query(static::getConnection());
8686
$query->sql(
8787
QueryBuilder::select($this->closureTable, ['child_id'])->where(['parent_id' => $this->id, 'depth' => 1])
8888
);

0 commit comments

Comments
 (0)