Throw exception in nested gridfields if the relation is invalid.

This commit is contained in:
Niklas Forsdahl 2024-04-24 10:42:55 +03:00
parent 5e6097214e
commit bc1180b62c

View File

@ -409,7 +409,7 @@ class GridFieldNestedForm extends AbstractGridFieldComponent implements
} }
$relationName = $this->getRelationName(); $relationName = $this->getRelationName();
if (!$record->hasMethod($relationName)) { if (!$record->hasMethod($relationName)) {
return ''; throw new Exception('Invalid relation name');
} }
$manager = $this->getStateManager(); $manager = $this->getStateManager();
$stateRequest = $request ?: $gridField->getForm()->getRequestHandler()->getRequest(); $stateRequest = $request ?: $gridField->getForm()->getRequestHandler()->getRequest();