Guest User

Untitled

a guest
Sep 11th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundleRepository;
  4. use AppBundleEntityDomini;
  5. use DoctrineORMEntityRepository;
  6.  
  7. class DominiRepository extends DoctrineORMEntityRepository
  8. {
  9. /**
  10. * @return dominio[]
  11. */
  12. public function findAllPublishedOrderedBySize()
  13. {
  14.  
  15. $query = 'SELECT dominio FROM AppBundle:Domini dominio';
  16. $mydomain = $this->getEntityManager()->createQuery($query);
  17. return $mydomain->execute();
  18.  
  19. }
  20. }
  21.  
  22. <?php
  23. // src/AppBundle/Controller/DominiController.php
  24. namespace AppBundleController;
  25.  
  26. use AppBundleEntityDomini;
  27. use SensioBundleFrameworkExtraBundleConfigurationMethod;
  28. use SensioBundleFrameworkExtraBundleConfigurationRoute;
  29. use SymfonyComponentHttpFoundationResponse;
  30. use SymfonyBundleFrameworkBundleControllerController;
  31. use DoctrineORMEntityManagerInterface;
  32.  
  33. class DominiController extends Controller
  34. {
  35. /**
  36. * @Route("/admin/domini")
  37. */
  38. public function dominiAction()
  39. {
  40. $title = "ADMIN";
  41. $nome_utente = $this->getUser();
  42.  
  43. $user = $this->getUser()->getId();
  44. $em = $this->getDoctrine()->getManager();
  45.  
  46. $dominilist = $em->getRepository('AppBundle:Domini')
  47. ->findAllPublishedOrderedBySize();
  48.  
  49. return $this->render('admin/domini.html.twig', [
  50. 'title' => $title,
  51. 'nome_utente' => $nome_utente,
  52. 'user' => $user,
  53. 'dominilist' => $dominilist,
  54. ]);
  55.  
  56. }
  57.  
  58. }
  59.  
  60. <h1>{{ title }}</h1>
  61. <h2>Benvenuto: {{ nome_utente }}</h2>
  62. <h3>USER ID:{{ user }}</h3>
  63.  
  64.  
  65. <ul>
  66. {% for item in dominilist %}
  67. <li>{{ item.dominio }}</li>
  68. {% endfor %}
  69. </ul>
Advertisement
Add Comment
Please, Sign In to add comment