From 72215e5f409961e40651256c4d6e5e2464708270 Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos Date: Fri, 26 Jan 2024 17:51:07 +0200 Subject: [PATCH] if the retrieved entity is null create an empty one to allow the title calculation to succeed --- app/src/Controller/ExternalIdentitySourcesController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/Controller/ExternalIdentitySourcesController.php b/app/src/Controller/ExternalIdentitySourcesController.php index f32718045..d81a4efad 100644 --- a/app/src/Controller/ExternalIdentitySourcesController.php +++ b/app/src/Controller/ExternalIdentitySourcesController.php @@ -119,6 +119,13 @@ public function retrieve(string $id) { ->first(); $this->set('vv_external_identity_record', $externalIdentityRecordObj); + if($externalIdentityRecordObj === null) { + // I need an empty entity + $ExtIdentitySourceRecords = $this->getTableLocator()->get('ExtIdentitySourceRecords'); + // Create an empty entity for FormHelper + $externalIdentityRecordObj = $ExtIdentitySourceRecords->newEmptyEntity(); + } + [$title, , ] = StringUtilities::entityAndActionToTitle($externalIdentityRecordObj, StringUtilities::entityToClassName($externalIdentityRecordObj), 'view');