Skip to content

Commit

Permalink
use primary_date_range property
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardocavazza committed Apr 19, 2023
1 parent 31f3388 commit d034a17
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Controller/Component/CalendarComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,18 +393,17 @@ public function findGroupedByDay(Query $query, FrozenTime $from, FrozenTime|null
$day = $start->format('Y-m-d');
$start = $start->addDay();
$event = clone $object;
$event->set('date_ranges', [$dr]);
$event->set('filtered_date_ranges', [$dr]);
$event->set('primary_date_range', $dr);

yield compact('event', 'day');
}
}
})
->groupBy('day')
->map(fn (array $items, string $day): array => collection($items)
->map(fn (array $items): array => collection($items)
->extract('event')
->sortBy(
fn (ObjectEntity $event): string => collection($event->filtered_date_ranges)->first()->start_date->format('c'),
fn (ObjectEntity $event): string => collection($event->primary_date_range)->first()->start_date->format('c'),
SORT_ASC,
SORT_NATURAL
)
Expand Down

0 comments on commit d034a17

Please sign in to comment.