From 9e32f2adb0e937aff02daadbeb60f6666e9cf5c0 Mon Sep 17 00:00:00 2001 From: Dylan Wagstaff Date: Fri, 23 Feb 2018 17:37:44 +1300 Subject: [PATCH] FIX Don't assume a DataObject's table. Knowing if a DataObject has a table or not is irrelevant - data is queried out and pushed into solr all the same, whether there is a join table, a base table, or any combination with maybe a few no-tables in between. SomeDataClass::get() will fetch all data irrelevant of tables, that's the point of an abstraction like SilverStripe's ORM. --- src/Search/Indexes/SearchIndex.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Search/Indexes/SearchIndex.php b/src/Search/Indexes/SearchIndex.php index 8be98b0..bdc3878 100644 --- a/src/Search/Indexes/SearchIndex.php +++ b/src/Search/Indexes/SearchIndex.php @@ -282,10 +282,6 @@ abstract class SearchIndex extends ViewableData throw new Exception('Can\'t add class to Index after fields have already been added'); } - if (!DataObject::getSchema()->classHasTable($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( 'include_children' => true ), $options);