diff --git a/src/Services/CacheProcessingService.php b/src/Services/CacheProcessingService.php index e4f9ea5..25242b8 100644 --- a/src/Services/CacheProcessingService.php +++ b/src/Services/CacheProcessingService.php @@ -22,6 +22,13 @@ abstract protected function shouldPublishUpdates(): bool; public function processChange(DataObject $instance): void { + // Can't process a record that hasn't been saved to the Database. This would only happen if a developer + // specifically calls processChange() in their code. All module hooks for this method are triggered *after* + // write() type events + if (!$instance->isInDB()) { + return; + } + $className = $instance->getClassName(); // This record has already been processed in full. It is possible for multiple write() actions to be performed