Fix on delete summit

Change-Id: I231a32ef831e3c1a3877a7ad1be73d67d098e71e
This commit is contained in:
smarcet 2019-09-09 18:26:01 -03:00
parent 08e644a434
commit a9a4819623
4 changed files with 14 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;
}
/**

View File

@ -1657,6 +1657,7 @@ final class SummitService extends AbstractService implements ISummitService
);
}
$summit->markAsDeleted();
$this->summit_repository->delete($summit);
Event::fire(new SummitDeleted($summit_id));

View File

@ -387,7 +387,7 @@ final class OAuth2SummitApiTest extends ProtectedApiTest
$summit = $this->testAddSummit();
$params = [
'id' => $summit->id
'id' => 31
];
$headers = [