Skip to content

Commit

Permalink
Update src/ORM/DataQuery.php
Browse files Browse the repository at this point in the history
Co-authored-by: Guy Sartorelli <[email protected]>
  • Loading branch information
lekoala and GuySartorelli authored Feb 8, 2024
1 parent 2ac68a5 commit e0107e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ORM/DataQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public function getFinalisedQuery($queriedColumns = null)
$collisionClassColumn = $schema->sqlColumnForField($collisionClass, 'ClassName');
$collisionClasses = ClassInfo::subclassesFor($collisionClass);
$collisionClassesSQL = implode(', ', Convert::raw2sql($collisionClasses, true));
// Only add clause if this is already joined "Unknown column 'ClassName' error"
// Only add clause if this is already joined to avoid "Unknown column 'ClassName'" error
$collisionTableForClassName = $schema->tableForField($collisionClass, 'ClassName');
if (array_key_exists($collisionTableForClassName, $query->getFrom())) {
$caseClauses[] = "WHEN {$collisionClassColumn} IN ({$collisionClassesSQL}) THEN $collision";
Expand Down

0 comments on commit e0107e0

Please sign in to comment.