<?php
namespace App\Controller;
use App\Entity\Anmeldung;
use App\Service\ConfigService;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
{
/**
* @Route("/", name="index")
*/
public function indexAction(ConfigService $config, EntityManagerInterface $em): Response
{
$anmeldungen = $em->getRepository(Anmeldung::class)
->findActiveCurrent(array('user'=>$this->getUser()));
$total = array();
foreach($anmeldungen as $anmeldung){
if($anmeldung->is4User($this->getUser())){
$total[] = $anmeldung;
}
}
return $this->render('page/dashboard.html.twig', [
'general_info_page' => $config->getConfig('general_info_page'),'anmeldungen'=>$total]
);
}
}