mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Fixed support for SearchFilter on many to many relations that don't have a component class DB table, but have a component base class table
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71401 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2d83cc412b
commit
52909a915c
@ -141,7 +141,10 @@ abstract class SearchFilter extends Object {
|
||||
$parentBaseClass = ClassInfo::baseDataClass($parentClass);
|
||||
$componentBaseClass = ClassInfo::baseDataClass($componentClass);
|
||||
$query->innerJoin($relationTable, "\"$relationTable\".\"$parentField\" = \"$parentBaseClass\".\"ID\"");
|
||||
$query->leftJoin($componentClass, "\"$relationTable\".\"$componentField\" = \"$componentClass\".\"ID\"");
|
||||
$query->leftJoin($componentBaseClass, "\"$relationTable\".\"$componentField\" = \"$componentBaseClass\".\"ID\"");
|
||||
if(ClassInfo::hasTable($componentClass)) {
|
||||
$query->leftJoin($componentClass, "\"$relationTable\".\"$componentField\" = \"$componentClass\".\"ID\"");
|
||||
}
|
||||
$this->model = $componentClass;
|
||||
|
||||
// Experimental support for user-defined relationships via a "(relName)Query" method
|
||||
|
Loading…
x
Reference in New Issue
Block a user