Make sure event instances are invalidated when registrants change

Created on 11 June 2024, 17 days ago
Updated 20 June 2024, 8 days ago

Problem/Motivation

When a registrant is added / changed / deleted, the cache of the parent event instance should be invalidated so that the availability count is updated. If the event registration type is "Series" then the event series should be invalidated as well.

Currently this is handled in form submit handlers, but whenever a registrant is updated programmatically the caches are not invalidated. This means that whenever a change is happening outside of a form the counts are outdated. This affects migrations, Drush commands, REST API calls etc.

Steps to reproduce

  1. Create a registrant for an event instance.
  2. Take note of the entity ID of the created registrant.
  3. View the event instance page so that it will become cached. Take note of the available places.
  4. Delete the registrant without using our form (e.g. drush entity:delete registrant {id})

Expected result: the availability count for the event instance should increase by 1.
Actual result: the caches are not invalidated and the availability count for the event instance remains the same.

Proposed resolution

Use EntityInterface::getCacheTagsToInvalidate() rather than manually invalidating the cache tags on form submit.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Recurring Events Registration (Submodule)

Created by

πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024