Merge pull request #1979 from nedmas/patch-1

BUGFIX: singleton('Group')->Members() fails
This commit is contained in:
Sam Minnée 2013-05-24 19:45:54 -07:00
commit 628391e3f1

View File

@ -251,9 +251,11 @@ class Group extends DataObject {
// Remove the default foreign key filter in prep for re-applying a filter containing all children groups. // Remove the default foreign key filter in prep for re-applying a filter containing all children groups.
// Filters are conjunctive in DataQuery by default, so this filter would otherwise overrule any less specific // Filters are conjunctive in DataQuery by default, so this filter would otherwise overrule any less specific
// ones. // ones.
if(!($result instanceof UnsavedRelationList)) {
$result = $result->alterDataQuery(function($query){ $result = $result->alterDataQuery(function($query){
$query->removeFilterOn('Group_Members'); $query->removeFilterOn('Group_Members');
}); });
}
// Now set all children groups as a new foreign key // Now set all children groups as a new foreign key
$groups = Group::get()->byIDs($this->collateFamilyIDs()); $groups = Group::get()->byIDs($this->collateFamilyIDs());
$result = $result->forForeignID($groups->column('ID'))->where($filter)->sort($sort)->limit($limit); $result = $result->forForeignID($groups->column('ID'))->where($filter)->sort($sort)->limit($limit);