mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-02 22:28:37 +02:00
BUGFIX: Fixed TableListField SQL generation so as not to add redundant duplicate columns. This builds on the change made in r50945, and keeps the behaviour the same as that, but note that r50945 removed the ability to include columns selected from a joined table, which was the original purpose of this code block.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79312 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
b536ecd610
commit
ab9c826ba2
@ -458,13 +458,6 @@ JS
|
|||||||
$query->select[] = "{$baseClass}.ClassName AS \"RecordClassName\"";
|
$query->select[] = "{$baseClass}.ClassName AS \"RecordClassName\"";
|
||||||
} else {
|
} else {
|
||||||
$query = singleton($this->sourceClass)->extendedSQL($this->sourceFilter(), $this->sourceSort, null, $this->sourceJoin);
|
$query = singleton($this->sourceClass)->extendedSQL($this->sourceFilter(), $this->sourceSort, null, $this->sourceJoin);
|
||||||
|
|
||||||
// Add more selected fields if they are from joined table.
|
|
||||||
foreach($this->FieldList() as $k => $title) {
|
|
||||||
if(!strpos($k, '.') && singleton($this->sourceClass)->hasDatabaseField($k)) {
|
|
||||||
$query->select[] = "\"$k\"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
if(isset($_REQUEST['ctf'][$this->Name()]['sort'])) {
|
||||||
@ -493,12 +486,6 @@ JS
|
|||||||
$query->select[] = "{$baseClass}.ClassName AS \"RecordClassName\"";
|
$query->select[] = "{$baseClass}.ClassName AS \"RecordClassName\"";
|
||||||
} else {
|
} else {
|
||||||
$query = singleton($this->sourceClass)->extendedSQL($this->sourceFilter(), $this->sourceSort, null, $this->sourceJoin);
|
$query = singleton($this->sourceClass)->extendedSQL($this->sourceFilter(), $this->sourceSort, null, $this->sourceJoin);
|
||||||
|
|
||||||
// Add more selected fields if they are from joined table.
|
|
||||||
foreach($this->FieldList() as $k=>$title){
|
|
||||||
if(singleton($this->sourceClass)->hasDatabaseField($k))
|
|
||||||
$query->select[] = "\"$k\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return clone $query;
|
return clone $query;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user