Refactor
This commit is contained in:
parent
2d55ea78f1
commit
7fab80a113
2 changed files with 5 additions and 3 deletions
|
@ -21,4 +21,8 @@ final class Event extends Paragraph implements ParagraphInterface {
|
|||
return $this->get('field_event_name')->value;
|
||||
}
|
||||
|
||||
public function isPast(): bool {
|
||||
return $this->getEventDate() < strtotime('today');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,10 +12,8 @@ final class Presentation extends Node implements NodeInterface {
|
|||
public const NODE_TYPE = 'presentation';
|
||||
|
||||
public function getPastEvents(): Events {
|
||||
$today = strtotime('today');
|
||||
|
||||
return Events::fromEvents($this->get('field_events')->referencedEntities())
|
||||
->filter(fn (Event $event) => $event->getEventDate() < $today);
|
||||
->filter(fn (Event $event) => $event->isPast());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue