aboutsummaryrefslogtreecommitdiff
path: root/lib/models/ConsultationBlock.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models/ConsultationBlock.php')
-rw-r--r--lib/models/ConsultationBlock.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/models/ConsultationBlock.php b/lib/models/ConsultationBlock.php
index fbc5de8..299820d 100644
--- a/lib/models/ConsultationBlock.php
+++ b/lib/models/ConsultationBlock.php
@@ -116,8 +116,8 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject
return array_values($persons);
};
- $config['registered_callbacks']['after_store'][] = function (ConsultationBlock $block) {
- $block->slots->updateEvents();
+ $config['registered_callbacks']['after_store'][] = function (ConsultationBlock $block): void {
+ $block->updateEvents();
};
parent::configure($config);
@@ -458,4 +458,14 @@ class ConsultationBlock extends SimpleORMap implements PrivacyObject
date('H:i', $this->end)
);
}
+
+ /**
+ * Convenience method that updates all events for all slots of this block.
+ */
+ public function updateEvents(): void
+ {
+ $this->slots->each(function (ConsultationSlot $slot): void {
+ $slot->updateEvents();
+ });
+ }
}