Skip to content

Commit

Permalink
Merge pull request #40 from Quinn-Interactive/hasfield-getfield-fix
Browse files Browse the repository at this point in the history
Use ShowInSearch rather than getField()
  • Loading branch information
wilr authored Mar 2, 2023
2 parents 5a8403b + 0df5e70 commit f58c91b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public function reIndex($stage = Versioned::LIVE)
return;
}

if (!$versionToIndex->hasField('ShowInSearch') || $versionToIndex->getField('ShowInSearch')) {
if (!$versionToIndex->hasField('ShowInSearch') || $versionToIndex->ShowInSearch) {
$this->service->index($versionToIndex);
} else {
$this->service->remove($versionToIndex);
Expand Down Expand Up @@ -505,7 +505,7 @@ protected function updateDependentClasses()

foreach ($list as $object) {
if ($object instanceof DataObject && $object->hasExtension(Searchable::class)) {
if (!$object->hasField('ShowInSearch') || $object->getField('ShowInSearch')) {
if (!$object->hasField('ShowInSearch') || $object->ShowInSearch) {
$this->service->index($object);
} else {
$this->service->remove($object);
Expand Down

0 comments on commit f58c91b

Please sign in to comment.