Skip to content

Commit

Permalink
PATCH: 8.2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnysideup committed Dec 12, 2023
1 parent d830785 commit 8ab1157
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Extensions/DataObjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ class DataObjectExtension extends DataExtension
{
public function onAfterWrite()
{
parent::onAfterWrite();

$owner = $this->getOwner();
$className = $owner->ClassName;

// NB.
// if the dataobject has the versioned extension then the cache should be invalidated onAfterPublish
// hasStages function is part of the Versioned class so safe to check here
if (! $owner->hasExtension(Versioned::class)) {
if (!$owner->hasExtension(Versioned::class)) {
$this->doUpdateCache($className);
} elseif (! $owner->hasStages()) {
} elseif (!$owner->hasStages()) {
$this->doUpdateCache($className);
}
}
Expand Down Expand Up @@ -98,6 +96,6 @@ private function canUpdateCache($className): bool
}
$excludedClasses = (array) Config::inst()->get(self::class, 'excluded_classes_for_caching');

return ! in_array($className, $excludedClasses, true);
return !in_array($className, $excludedClasses, true);
}
}

0 comments on commit 8ab1157

Please sign in to comment.