Issue #3624648: Add option to purge registrations on registrant delete

Adds the option to purge the registrations of a deleted registrant to Registration Purger (#3624648):

  • New setting purge_registration_on_registrant_delete (default false) in registration_purger.settings: schema, install config, registration_purger_update_10002(), and an "On registrant delete" fieldset in the purger section of the registration settings form.
  • RegistrationPurger::onEntityDelete() calls the new purgeRegistrantRegistrations() for content entities when the setting is on. It finds the registration types whose registrant entity type matches the deleted entity and deletes their registrations with that registrant (in chunks of 50), so it works for users and for other registrant entity types.
  • purgeRegistrantRegistrations() is added to RegistrationPurgerInterface.

Tests:

  • RegistrationPurgerTest::testRegistrationPurgerOnRegistrantDelete(): with the setting off, a deleted user's registrations are kept. With it on, they are purged and the registrations of other users and the host settings are untouched. Node registrants (a "seminar" type with node registrants) are purged too, but a user-registrant registration with the same ID is not. Manual purge works. It fails without the change.
  • phpunit (sqlite) on Drupal 11.4 / PHP 8.4: 3 tests, 114 assertions, OK. phpcs --standard=Drupal,DrupalPractice: no new warnings (the 19 existing ones are unchanged).

Issue: https://www.drupal.org/i/3624648

Text generated with AI

Merge request reports

Loading
Loading