Don't sort events if there's only one event
This commit is contained in:
parent
b1145ab613
commit
f6de1df830
|
@ -41,6 +41,12 @@ final class UpdateTalkNodeBeforeSave implements EventSubscriberInterface {
|
|||
|
||||
private function reorderEvents(Talk $talk): void {
|
||||
$events = $talk->getEvents();
|
||||
|
||||
// If there is only one event, there's no need to sort them.
|
||||
if ($events->count() === 1) {
|
||||
return;
|
||||
};
|
||||
|
||||
$eventsByDate = $this->sortEventsByDate($events);
|
||||
|
||||
// If the original event IDs don't match the sorted event IDs, update the event field to use the sorted ones.
|
||||
|
|
Loading…
Reference in a new issue