src/Controller/DefaultController.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Anmeldung;
  4. use App\Service\ConfigService;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class DefaultController extends AbstractController
  10. {
  11.     /**
  12.      * @Route("/", name="index")
  13.      */
  14.     public function indexAction(ConfigService $configEntityManagerInterface $em): Response
  15.     {
  16.         $anmeldungen $em->getRepository(Anmeldung::class)
  17.         ->findActiveCurrent(array('user'=>$this->getUser()));
  18.         
  19.         $total = array();
  20.         foreach($anmeldungen as $anmeldung){
  21.             if($anmeldung->is4User($this->getUser())){
  22.                 $total[] = $anmeldung;
  23.             }
  24.         }
  25.         
  26.         return $this->render('page/dashboard.html.twig', [
  27.             'general_info_page' => $config->getConfig('general_info_page'),'anmeldungen'=>$total]
  28.         );
  29.     }
  30. }