Drupal\Core\Entity\EntityStorageException: Invalid Relationship in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() and invalid relationship.

Created on 20 March 2023, over 1 year ago
Updated 21 March 2023, over 1 year ago

I would highly appriciate any help on this. Since we are upgrading the whole system to D9 and lastest civicrm, at the moment it is not possible to upgrade this module.

We have a webform created using webform_civicrm 8.x-5.0-beta8 running on Civicrm 5.39.1 and Drupal 9.8.20.

Upon submission an error is preventing it from full submission.
Form has been working for months perfectly well, but now we ecounter this error upon submission.

The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\EntityStorageException: Invalid Relationship in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php).

The form submits to civicrm Case type while pulls and prepopulates the data of current submitter along with optional to submit three co-submitters, which are empty when form loads.

As I have seen through basic debugging, even when all co-sumitter(s) fields are left empty webform still tries to make api calls to create their relationships i.e. wf_civicrm_api('relationship', 'create', Array) .

The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityStorageException: Invalid Relationship in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 846 of core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php).
Drupal\webform_civicrm\Utils->wf_civicrm_api('relationship', 'create', Array) (Line: 1464)
Drupal\webform_civicrm\WebformCivicrmPostProcess->processCases() (Line: 282)
Drupal\webform_civicrm\WebformCivicrmPostProcess->postSave(Object) (Line: 148)
Drupal\webform_civicrm\Plugin\WebformHandler\CivicrmWebformHandler->postSave(Object, , NULL) (Line: 2751)
Drupal\webform\Entity\Webform->invokeHandlers('postSave', Object, , NULL) (Line: 1212)
Drupal\webform\WebformSubmissionStorage->invokeWebformHandlers('postSave', Object, ) (Line: 1120)
Drupal\webform\WebformSubmissionStorage->doPostSave(Object, ) (Line: 460)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 837)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 983)
Drupal\webform\WebformSubmissionStorage->save(Object) (Line: 395)
Drupal\Core\Entity\EntityBase->save() (Line: 887)
Drupal\webform\Entity\WebformSubmission->save() (Line: 1972)
Drupal\webform\WebformSubmissionForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('webform_submission_srg_application_form_add_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 61)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'add') (Line: 1243)
Drupal\webform\Entity\Webform->getSubmissionForm() (Line: 76)
Drupal\webform\Controller\WebformEntityController->addForm(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 20)
💬 Support request
Status

Active

Component

CiviCRM Data Handling

Created by

🇩🇰Denmark monsoon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @monsoon
  • 🇨🇦Canada karing 🇨🇦

    The webform_civicrm version you're using is no longer supported (current supported / recommended release is 6.2.3) and CiviCRM Core has had a number of security releases since 5.39.1 and somewhere along the way CiviCRM Case was removed from CiviCRM Core and pushed into an Extension that ships with Core.

    My advice is to upgrade onto the latest versions first (perhaps in a dev environment) - and then report back if feel there is a bug with details - and your webform YAML.

  • 🇩🇰Denmark monsoon

    Thank you very much for reply. I will follow the route you have recommended.

Production build 0.71.5 2024