I have been told that to make $searchable_fields based on members group or permissions I have to use a public function searchableFields() instead of a static $searchable_fields. However I cannot figure out the syntax.
I need one set of searchable fields for one user group and another set for another user group for the same DataObject.
I figured it would be:
public function searchableFields() {
$member = Member::currentUser();
$searchable_fields = array(
'BestNotesID',
'FirstName',
'Surname',
'Therapist.FirstName',
'StudentGroup.Name'
);
if ($member && $member->inGroups(array('office-staff', 'office-managers'))) {
$searchable_fields[] = 'OfficeLocation';
{
return $searchable_fields;
}
This code throws the error: Fatal error: Class 'B' not found in ....... sapphire/core/model/DataObject.php on line 1632