Skip to content

Commit

Permalink
FIX Use instanceof check for $object against DBString
Browse files Browse the repository at this point in the history
Fixes #162
  • Loading branch information
robbieaverill committed Nov 15, 2017
1 parent 992bb5a commit a26f437
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions code/search/indexes/SearchIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

use Exception;
use InvalidArgumentException;
use SilverStripe\View\ViewableData;
use SilverStripe\ORM\DataObject;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\FullTextSearch\Search\SearchIntrospection;
use SilverStripe\FullTextSearch\Search\Variants\SearchVariant;
use SilverStripe\FullTextSearch\Utils\MultipleArrayIterator;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBString;
use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\View\ViewableData;

/**
* SearchIndex is the base index class. Each connector will provide a subclass of this that
Expand Down Expand Up @@ -366,7 +367,7 @@ public function addAllFulltextFields($includeSubclasses = true)
// Get class from shortName
$object = Injector::inst()->get($type, false, ['Name' => 'test']);

if (is_subclass_of(get_class($object), 'SilverStripe\ORM\FieldType\DBString')) {
if ($object instanceof DBString) {
$this->addFulltextField($field);
}
}
Expand Down

0 comments on commit a26f437

Please sign in to comment.