Skip to content
Snippets Groups Projects
Commit 2123c5e4 authored by dpi's avatar dpi
Browse files

Groups are now dereferenced from Registrations when deleted.

Fixed #28
parent 07115713
No related branches found
No related tags found
No related merge requests found
......@@ -179,13 +179,21 @@ class Group extends ContentEntityBase implements GroupInterface {
$event_manager = \Drupal::service('rng.event_manager');
foreach ($entities as $group) {
// Remove entity field references from the event to group in
// $event->{EventManagerInterface::FIELD_REGISTRATION_GROUPS}
if ($event = $group->getEvent()) {
$event_manager
->getMeta($event)
$event_meta = $event_manager->getMeta($event);
// Remove entity field references from the event to group in
// $event->{EventManagerInterface::FIELD_REGISTRATION_GROUPS}
$event_meta
->removeGroup($group->id())
->save();
// Remove entity field references from registrations to group.
foreach ($event_meta->getRegistrations() as $registration) {
$registration
->removeGroup($group)
->save();
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment