mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-29 20:59:23 +02:00
Throw error message when searchable_field does not return a object
While upgrading 4.2 to 4.3 the behaviour of GridFieldFilterHeader has changed (example code: https://gist.github.com/wilr/7c59f577e1d072eb66e4c0c84cba6732). This patch doesn’t affect the behaviour (since the explict object is a better API) but it makes upgrading easier to identify the field.
This commit is contained in:
parent
b8122f88c5
commit
d4f6ff98c8
@ -2241,7 +2241,15 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
|
||||
// Otherwise, use the database field's scaffolder
|
||||
} elseif ($object = $this->relObject($fieldName)) {
|
||||
if (is_object($object) && $object->hasMethod('scaffoldSearchField')) {
|
||||
$field = $object->scaffoldSearchField();
|
||||
} else {
|
||||
throw new Exception(sprintf(
|
||||
"SearchField '%s' on '%s' does not return a valid DBField instance.",
|
||||
$fieldName,
|
||||
get_class($this)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Allow fields to opt out of search
|
||||
|
Loading…
Reference in New Issue
Block a user