diff --git a/app/Models/Foundation/Summit/Events/SummitEvent.php b/app/Models/Foundation/Summit/Events/SummitEvent.php index 988acf7d..ad7f378a 100644 --- a/app/Models/Foundation/Summit/Events/SummitEvent.php +++ b/app/Models/Foundation/Summit/Events/SummitEvent.php @@ -779,6 +779,7 @@ class SummitEvent extends SilverstripeBaseModel */ public function deleted($args){ + if($this->summit->isDeleting()) return; Event::fire(new SummitEventDeleted($this, $this->pre_remove_events )); $this->pre_remove_events = null; } diff --git a/app/Models/Foundation/Summit/Summit.php b/app/Models/Foundation/Summit/Summit.php index 00d39a84..d84a0aec 100644 --- a/app/Models/Foundation/Summit/Summit.php +++ b/app/Models/Foundation/Summit/Summit.php @@ -600,6 +600,17 @@ class Summit extends SilverstripeBaseModel $this->notifications = new ArrayCollection; $this->selection_plans = new ArrayCollection; $this->meeting_booking_room_allowed_attributes = new ArrayCollection(); + $this->mark_as_deleted = false; + } + + private $mark_as_deleted; + + public function markAsDeleted(){ + $this->mark_as_deleted = true; + } + + public function isDeleting():bool{ + return $this->mark_as_deleted; } /** diff --git a/app/Services/Model/SummitService.php b/app/Services/Model/SummitService.php index 9797f3df..5bdb7b04 100644 --- a/app/Services/Model/SummitService.php +++ b/app/Services/Model/SummitService.php @@ -1657,6 +1657,7 @@ final class SummitService extends AbstractService implements ISummitService ); } + $summit->markAsDeleted(); $this->summit_repository->delete($summit); Event::fire(new SummitDeleted($summit_id)); diff --git a/tests/OAuth2SummitApiTest.php b/tests/OAuth2SummitApiTest.php index 712336d1..61b3f7bc 100644 --- a/tests/OAuth2SummitApiTest.php +++ b/tests/OAuth2SummitApiTest.php @@ -387,7 +387,7 @@ final class OAuth2SummitApiTest extends ProtectedApiTest $summit = $this->testAddSummit(); $params = [ - 'id' => $summit->id + 'id' => 31 ]; $headers = [