Skip to content

Commit

Permalink
fixed #238 by using column names defined in the model
Browse files Browse the repository at this point in the history
  • Loading branch information
franzose committed Oct 5, 2020
1 parent c4f53b9 commit 257cd50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Models/ClosureTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ private function selectRowsToInsert($ancestorId, $descendantId)
$depth = $this->getDepthColumn();

$select = "
SELECT tbl.{$ancestor} AS ancestor, ? AS descendant, tbl.{$depth}+1 AS depth
SELECT tbl.{$ancestor} AS {$ancestor}, ? AS {$descendant}, tbl.{$depth}+1 AS {$depth}
FROM {$table} AS tbl
WHERE tbl.{$descendant} = ?
UNION ALL
SELECT ? AS ancestor, ? AS descendant, 0 AS depth
SELECT ? AS {$ancestor}, ? AS {$descendant}, 0 AS {$depth}
";

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

0 comments on commit 257cd50

Please sign in to comment.