mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Making sure that Dataobject->getManyManyJoin() inserts a valid database table for the relation - not all component classes returned by ComponentSet->ownerClass are valid tables (see r54797 and r60909 for previous commits on this issue)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63621 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
370343016f
commit
1307d3da41
@ -1266,10 +1266,11 @@ class DataObject extends ViewableData implements DataObjectInterface {
|
||||
|
||||
list($parentClass, $componentClass, $parentField, $componentField, $table) = $this->many_many($componentName);
|
||||
|
||||
$baseComponentClass = ClassInfo::baseDataClass($componentClass);
|
||||
if($baseTable == $parentClass) {
|
||||
return "LEFT JOIN `$table` ON (`$table`.`$parentField` = `$parentClass`.`ID` AND `$table`.`$componentField` = '{$this->ID}')";
|
||||
} else {
|
||||
return "LEFT JOIN `$table` ON (`$table`.`$componentField` = `$componentClass`.`ID` AND `$table`.`$parentField` = '{$this->ID}')";
|
||||
return "LEFT JOIN `$table` ON (`$table`.`$componentField` = `$baseComponentClass`.`ID` AND `$table`.`$parentField` = '{$this->ID}')";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user