Skip to content

Commit

Permalink
Add check for data object when getting document dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Dunn committed Apr 19, 2024
1 parent 37f5276 commit 5613b5f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/DataObject/DataObjectDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,17 @@ public function getDependentDocuments(): array
return is_subclass_of($class, DataObject::class);
});
$ownedDataObject = $this->getDataObject();

$docs = [];

// make sure we have a data object
// if not (it might have been deleted), then return empty dependency
// documents with the assumption that if there are any dependencies
// they will be handled separately
if (!$ownedDataObject) {
return $docs;
}

foreach ($dataObjectClasses as $class) {
// Start with a singleton to look at the model first, then get real records if needed
$owningDataObject = Injector::inst()->get($class);
Expand Down

0 comments on commit 5613b5f

Please sign in to comment.