Newer
Older
activity-manager / src / Controller / MainController.php
<?php
namespace App\Controller;

use App\Entity\ActivityEntity;
use App\Repository\ActivityRepository;
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);

        // Get activities
        $activities = $activityRepository->findActiveFollowed();

        return $this->render('home.html.twig', [
            'activities' => $activities
        ]);
    }
}