Advertisement
Guest User

DefaultController.php

a guest
Oct 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Controller;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use App\Entity\Nutrizionista;
  9. use App\Entity\Utente;
  10. use App\Repository\UtenteRepository;
  11.  
  12.  
  13.  
  14. class DefaultController extends Controller
  15. {
  16. /**
  17. * @Route("/", name="home")
  18. */
  19. public function homepage()
  20. {
  21. $em = $this->getDoctrine()->getManager();
  22.  
  23. $lastnutrizionisti = $em->getRepository('App:Nutrizionista')->findBy(array(), array('id'=>'desc'), 4,0);
  24. $lastarticles = $em->getRepository('App:Articolo')->findBy(array(), array('id'=>'desc'), 4,0);
  25.  
  26. $formSearch = $this->createForm('App\Form\SearchType', null);
  27. //$risultati = $em->getRepository('App:Utente')->findBySearch($formSearch->getData());
  28.  
  29. // replace this example code with whatever you need
  30. return $this->render('default/index.html.twig', [
  31. //'risultati' => $risultati,
  32. 'form_search' => $formSearch->createView(),
  33. 'last_nutrizionisti' => $lastnutrizionisti,
  34. 'lastarticles' => $lastarticles,
  35. ]);
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement