diff --git a/src/Database/Models/DeferredBinding.php b/src/Database/Models/DeferredBinding.php index b00c5175f..30cedbfa8 100644 --- a/src/Database/Models/DeferredBinding.php +++ b/src/Database/Models/DeferredBinding.php @@ -206,7 +206,7 @@ protected function deleteSlaveRecord() // Only delete it if the relationship is null $foreignKey = array_get($options, 'key', $masterObject->getForeignKey()); - if (!$relatedObj->$foreignKey) { + if ($foreignKey && !$relatedObj->$foreignKey) { $relatedObj->delete(); } }