Skip to content

Commit

Permalink
Harden the ShowInSearch check
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Erkelens committed Oct 16, 2023
1 parent 6d98db3 commit 5f69846
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Extensions/DataObjectElasticExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ public function onAfterWrite()
}

// @codeCoverageIgnoreStart Elastic during tests isn't fast enough to pick this up properly
if ($this->owner->isChanged('ShowInSearch') && !$this->owner->ShowInSearch) {
if ($this->owner->hasField('ShowInSearch') &&
$this->owner->isChanged('ShowInSearch') &&
!$this->owner->ShowInSearch) {
$this->deleteFromElastic();
}
// @codeCoverageIgnoreEnd
Expand Down

0 comments on commit 5f69846

Please sign in to comment.