Google Groups

$searchable_fields defaulting to $summay_fields: error when method names are used

Martimiz Sep 1, 2012 5:43 AM
Posted in group: SilverStripe Core Development
Hi all,

It's perfectly allright to use method names in $summary_fields, but it leads to an error message when $searchable_fields are not defined:

[User Error] Uncaught Exception: Unable to traverse to related object field [SomeMethodName] on [MyObject]

Yet nowhere it states that you have to define $searchable_fields. What happens is $searchable_fields defaults to $summary fields, and $searchable_fields doesn't accept method names. And the error isn't very clear, people tend to blame the method name in $summary_fields, which is perfectly legit. What would be the proper course of action:

- strip out all method names in $searchable_fields, and suppress the error only if we have defaulted to $summary_fields?
- disable filtering alltogether if no searchable_fields are set (seems sort of logical to me)?
- leave it as it is?

(Existing) ticket here: