Skip to content
Snippets Groups Projects
Commit 09dc9496 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

fix creation and deletion of consultation events, fixes #982

Closes #982

Merge request studip/studip!971
parent 490dd0b0
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@
* @property bool has_bookings computed column
* @property Range range computed column
* @property SimpleORMapCollection slots has_many ConsultationSlot
* @property ConsultationResponsibility[] responsibilities has_many ConsultationResponsibility
* @property ConsultationResponsibility[]|SimpleCollection responsibilities has_many ConsultationResponsibility
* @property User[] responsible_persons
*/
class ConsultationBlock extends SimpleORMap implements PrivacyObject
......
......@@ -22,7 +22,7 @@ class ConsultationEvent extends SimpleORMap
'class_name' => ConsultationSlot::class,
'foreign_key' => 'slot_id',
];
$config['belongs_to']['event'] = [
$config['has_one']['event'] = [
'class_name' => EventData::class,
'foreign_key' => 'event_id',
'assoc_foreign_key' => 'event_id',
......
......@@ -193,6 +193,10 @@ class ConsultationSlot extends SimpleORMap
*/
public function updateEvents()
{
if ($this->isNew()) {
return;
}
// If no range is associated, remove the event
if (!$this->block->range) {
$this->events->delete();
......
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