From 9ab3ed67a75c0060e9303abd9822a9751bf6afe4 Mon Sep 17 00:00:00 2001 From: Niklas Forsdahl Date: Tue, 7 May 2024 12:36:44 +0300 Subject: [PATCH] Throw an exception in Nesed Gridfield if an invalid relation is configured. --- src/GridFieldNestedForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GridFieldNestedForm.php b/src/GridFieldNestedForm.php index 3e0c13d..a569b3c 100644 --- a/src/GridFieldNestedForm.php +++ b/src/GridFieldNestedForm.php @@ -215,7 +215,7 @@ class GridFieldNestedForm extends AbstractGridFieldComponent implements $this->gridField = $gridField; $relationName = $this->getRelationName(); if (!$record->hasMethod($relationName)) { - return ''; + throw new Exception('Invalid relation name'); } if ($this->canExpandCallback) { if (is_callable($this->canExpandCallback)