EventSeriesForm breaks when editing an empty entity.

Created on 28 October 2024, 27 days ago

Problem/Motivation

Steps to reproduce

I had this issue when I tried to use this module with the conditional_fields module.
I tried to add some conditional fields to the eventseries entity but failed.
The following error message appears.

The website encountered an unexpected error. Try again later.
AssertionError: Cannot load the "eventseries" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

Proposed resolution

Validate the entity before loading it.
As the module use the following logic $editing = ($form_state->getBuildInfo()['form_id'] == 'eventseries_' . $entity->bundle() . '_edit_form'); to check if the form operation is editing. We could also update line 233 of the EventSeriesForm file to check if the entity exists.

if ($editing && $entity->id()) {
      $original = $this->storage->loadUnchanged($entity->id());
      if ($this->step === 1) {
      ..........

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Recurring Events (Main module)

Created by

🇧🇷Brazil joaopauloc.dev

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024