Skip to content

Commit 257cd50

Browse files
committed
fixed #238 by using column names defined in the model
1 parent c4f53b9 commit 257cd50

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Models/ClosureTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ private function selectRowsToInsert($ancestorId, $descendantId)
6060
$depth = $this->getDepthColumn();
6161

6262
$select = "
63-
SELECT tbl.{$ancestor} AS ancestor, ? AS descendant, tbl.{$depth}+1 AS depth
63+
SELECT tbl.{$ancestor} AS {$ancestor}, ? AS {$descendant}, tbl.{$depth}+1 AS {$depth}
6464
FROM {$table} AS tbl
6565
WHERE tbl.{$descendant} = ?
6666
UNION ALL
67-
SELECT ? AS ancestor, ? AS descendant, 0 AS depth
67+
SELECT ? AS {$ancestor}, ? AS {$descendant}, 0 AS {$depth}
6868
";
6969

7070
$rows = $this->getConnection()->select($select, [

0 commit comments

Comments
 (0)