LettreInfosController.php 1.38 KB
Newer Older
1 2 3 4 5 6
<?php

namespace PotageBundle\Controller;


//use APIBundle\Form\InfoAPIType;
7
use APIBundle\Form\LettreAPIType;
8 9 10 11 12 13 14 15 16 17 18 19
use APIBundle\Form\LettreSortedAPIType;

class LettreInfosController extends MasterController
{
    
    /**
     * @param $id
     * @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
     * @throws \Doctrine\ORM\NonUniqueResultException
     */
    public function ajaxDisplayAction($id)
    {
20 21 22
        $em = $this->getDoctrine()->getManager();
        $lettre = $em->getRepository('PotageBundle:Lettre')->findOneForLettreInfosAjaxDisplay($id);
        $autresLettres = $em->getRepository('PotageBundle:Lettre')->findAllBrotherLettre($id);
23 24 25 26 27 28
        
        if ($lettre === null) {
            return $this->createNotFoundException('Non trouvé');
        }
        
        //$form = $this->createForm(InfoAPIType::class);
29
        $formLettre = $this->createForm(LettreAPIType::class);
30 31 32 33 34
        $formSorted = $this->createForm(LettreSortedAPIType::class);
        
        return $this->render('@Potage/LettreInfos/ajaxDisplay.html.twig', array(
            'id' => $id,
            'lettre' => $lettre,
35
            'autresLettres' => $autresLettres,
36
            //'formInfo' => $form->createView(),
37
            'formLettre' =>$formLettre->createView(),
38 39 40 41
            'formLettreSorted' => $formSorted->createView()
        ));
    }
}