Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @Route("/test/")
- */
- public function indexAction(){
- $em = $this->getDoctrine()->getManager();
- $przedmiots = $em->getRepository('AppBundle:Przedmiot')->findAll();
- $query = $em->createQuery(
- //'SELECT p FROM AppBundle:Przedmiot p ORDER BY p.nazwa ASC'
- 'SELECT SUM(p.laboratoriumLiczbaGodz) FROM AppBundle:Przydzial p WHERE p.idPrzedmiot = 2'
- );
- $suma = $query->getResult();
- //$przydzials = $query->setMaxResults(1)->getOneOrNullResult();
- return $this->render('statystyki/index.html.twig', array(
- 'suma' => $suma[0],'przedmiots' => $przedmiots,
- ));
- }
- w Twigu:
- {% for suma in suma %}
- {{ suma }}
- {% endfor %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement