RVRNEXT-11 add upcoming events for user

This commit is contained in:
bence committed 2023-05-28 16:48:38 +02:00
1 parent a128168e7f
commit f370ccba88
2 files changed
+13 -2

No files matched your search

+6 -1
View File
@@ -1,8 +1,10 @@
<?php namespace RVR\Controller;
use DateTime;
use RVR\PersistentData\Model\Community;
use RVR\PersistentData\Model\User;
use RVR\Repository\CommunityMemberRepository;
use RVR\Repository\EventRepository;
use SokoWeb\Interfaces\Authentication\IAuthenticationRequired;
use SokoWeb\Interfaces\Response\IContent;
use SokoWeb\Response\HtmlContent;
@@ -11,9 +13,12 @@ class HomeController implements IAuthenticationRequired
{
private CommunityMemberRepository $communityMemberRepository;
private EventRepository $eventRepository;
public function __construct()
{
$this->communityMemberRepository = new CommunityMemberRepository();
$this->eventRepository = new EventRepository();
}
public function isAuthenticationRequired(): bool
@@ -39,7 +44,7 @@ class HomeController implements IAuthenticationRequired
return new HtmlContent('home', [
'communities' => $communities,
'upcomingEvents' => []
'upcomingEvents' => iterator_to_array($this->eventRepository->getUpcomingByUser($user, new DateTime(), 3, true, ['community']))
]);
}
}