Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

filterAny Search with joined columns possible?


Go to End


1336 Views

Avatar
Matty Balaam

Community Member, 74 Posts

3 February 2015 at 11:21pm

Edited: 03/02/2015 11:21pm

I am running a search on a Member object using filterAny.

Simplified example:

$entries = Member::get()
->filterAny(array(
'Name:PartialMatch' => $searchString,
'Surname:PartialMatch' => $searchString,
'Telephone:PartialMatch' =>$searchString
));

This works fine for searching for 'Jane' or 'Smith', but a search for 'Jane Smith' will return nothing.

How might I go about changing this to allow a search of a full name?