mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Update src/ORM/DataQuery.php
Co-authored-by: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com>
This commit is contained in:
parent
2ac68a55a4
commit
e0107e0202
@ -298,7 +298,7 @@ class DataQuery
|
||||
$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";
|
||||
|
Loading…
Reference in New Issue
Block a user