mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10763 from sunnysideup/patch-25
MINOR: faster checking if record exists
This commit is contained in:
commit
1c2e1f86a5
@ -924,15 +924,8 @@ class Member extends DataObject
|
||||
}
|
||||
|
||||
$groupCandidateObjs = ($strict) ? $this->getManyManyComponents("Groups") : $this->Groups();
|
||||
if ($groupCandidateObjs) {
|
||||
foreach ($groupCandidateObjs as $groupCandidateObj) {
|
||||
if ($groupCandidateObj->ID == $groupCheckObj->ID) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return $groupCandidateObjs->filter(['ID' => $groupCheckObj->ID])->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user