Hi folks,
at the moment I'm working on some portal and encountered a problem with scaffolded search forms. I'm using a code example from the wiki to create a search form in my application.
Everything works fine, except the fact that I only get one field for the search. As far as I understood the magic, there should be one search field per defined (whitelist) field in my getCustomSearchField() method.
I did some debug on the $fields with Debug::dump() which showed me a larger object structure where I could only find the "title" and some recursions, but not the other defined fields.
I double-checked my database declarations in the model and all fields are there, icluding the correct data types.
Any ideas?
code:
public function getCustomSearchContext()
{
$fields = $this->scaffoldSearchFields( array(
'restrictFields' => array(
'Title',
'Content',
'Instrument',
'Plz',
'Location',
'Ambition',
'ExpiryDate'
)
)
);
$filters = array(
'Title' => new PartialMatchFilter( 'Title' ),
'Content' => new PartialMatchFilter( 'Content' ),
'Instrument' => new ExactMatchFilter( 'Instrument' ),
'Plz' => new PartialMatchFilter( 'Plz' ),
'Location' => new ExactMatchFilter( 'Location' ),
'Ambition' => new ExactMatchFilter( 'Ambition' ),
'ExpiryDate' => new LessThanFilter( 'ExpiryDate' ),
);
return new SearchContext(
$this->class,
$fields,
$filters
);
}