/** * Determine if the given member belongs to the given relation. * * @param Member $member * @param DataList $relation * * @return bool */ protected function isMemberOf($member, $relation) { if (!$member || !$member->exists()) { return false; } if ($relation instanceof UnsavedRelationList) { return in_array($member->ID, $relation->getIDList()); } return $relation->byID($member->ID) !== null; }