From 50fd80930397ab910e7a92c33fed830b745ce248 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 4 Mar 2024 11:53:03 +0000 Subject: [PATCH] Issue #3404304 by GafgarionMorua, ksere, alexpott: EntityField::getFieldStorageDefinition() should throw an exception when it can't return a field storage --- core/modules/views/src/Plugin/views/field/EntityField.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/modules/views/src/Plugin/views/field/EntityField.php b/core/modules/views/src/Plugin/views/field/EntityField.php index e0b0f3841b21..2c6ae520e461 100644 --- a/core/modules/views/src/Plugin/views/field/EntityField.php +++ b/core/modules/views/src/Plugin/views/field/EntityField.php @@ -356,6 +356,9 @@ public function clickSort($order) { * * @return \Drupal\Core\Field\FieldStorageDefinitionInterface * The field storage definition used by this handler. + * + * @throws \Exception + * If no field storage definition was found for the given entity type and field name. */ protected function getFieldStorageDefinition() { $entity_type_id = $this->definition['entity_type']; @@ -391,7 +394,7 @@ protected function getFieldStorageDefinition() { } } - return NULL; + throw new \Exception("No field storage definition found for entity type {$this->definition['entity_type']} and field {$this->definition['field_name']} on view {$this->view->storage->id()}"); } /** -- GitLab