<?php namespace App\Controller; use App\Entity\ActivityEntity; use App\Entity\TaskEntity; use App\Enum\StatusEnum; use App\Repository\ActivityRepository; use App\Repository\TaskRepository; use Symfony\Component\HttpFoundation\Response; /** * Controller for main view */ class MainController extends AbstractExtendedController { /** * Home page * * @return Response */ public function home(): Response { // Get repositories $entityManager = $this->getDoctrine()->getManager(); /** @var ActivityRepository $activityRepository */ $activityRepository = $entityManager->getRepository(ActivityEntity::class); /** @var TaskRepository $taskRepository */ $taskRepository = $entityManager->getRepository(TaskEntity::class); // Get activities $activities = $activityRepository->findActiveFollowed(); // Get tasks $tasks = $taskRepository->findBy([ 'status' => StatusEnum::ACTIVE_STATUS, ]); return $this->render('home.html.twig', [ 'activities' => $activities, 'tasks' => $tasks, ]); } }