This commit is contained in:
Oliver Davies 2025-06-14 19:10:56 +01:00
parent 7fab80a113
commit 820f8d4055
2 changed files with 6 additions and 1 deletions

View file

@ -26,6 +26,11 @@ readonly final class Events implements \IteratorAggregate {
return new \ArrayIterator($this->events);
}
public function getPast(): self {
return (new self($this->events))
->filter(fn (Event $event): bool => $event->isPast());
}
/**
* @param Event[] $events
*/

View file

@ -13,7 +13,7 @@ final class Presentation extends Node implements NodeInterface {
public function getPastEvents(): Events {
return Events::fromEvents($this->get('field_events')->referencedEntities())
->filter(fn (Event $event) => $event->isPast());
->getPast();
}
}