Merge pull request #21 from silverstripe-rebelalliance/fix/not_indexing_tableless_classes
FIX Throw error if trying to add a table-less DataObject class to index
This commit is contained in:
commit
3ab71f70b0
|
@ -187,6 +187,10 @@ abstract class SearchIndex extends ViewableData {
|
||||||
throw new Exception('Can\'t add class to Index after fields have already been added');
|
throw new Exception('Can\'t add class to Index after fields have already been added');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DataObject::has_own_table($class)) {
|
||||||
|
throw new InvalidArgumentException('Can\'t add classes which don\'t have data tables (no $db or $has_one set on the class)');
|
||||||
|
}
|
||||||
|
|
||||||
$options = array_merge(array(
|
$options = array_merge(array(
|
||||||
'include_children' => true
|
'include_children' => true
|
||||||
), $options);
|
), $options);
|
||||||
|
|
Loading…
Reference in New Issue