UtilisateurController.php 1.47 KB
Newer Older
1 2 3 4 5
<?php

namespace PotageBundle\Controller;

use APIBundle\Form\UtilisateurAPIType;
6
use Symfony\Component\HttpFoundation\Request;
7 8 9 10 11 12 13 14 15 16 17 18 19 20

class UtilisateurController extends MasterController
{
    /**
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function ajaxDisplayAction()
    {
        $form = $this->createForm(UtilisateurAPIType::class);
        
        return $this->render('@Potage/Utilisateur/ajaxDisplay.html.twig', array(
            'formUtilisateur' => $form->createView()
        ));
    }
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
    
    
    /**
     * TESTS
     *
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function testReadAction(Request $request)
    {
        // defaults
        $paginate = ($request->query->get('step') !== null) ? $request->query->get('step') : 10;
        $start = ($request->query->get('page') !== null) ? $request->query->get('page') : 1;
        $column = ($request->query->get('column') !== null) ? $request->query->get('column') : 'id';
        $order = ($request->query->get('order') !== null) ? $request->query->get('order') : 'ASC';
    
        $utilisateurs = $this->getDoctrine()->getManager()
            ->getRepository('PotageBundle:Utilisateur')
            ->findAllForAPIReadPaginate($paginate, $start, $column, $order);
    
        dump($utilisateurs);
        return $this->render('@Potage/Default/test.html.twig', array(
            'utilisateurs' => $utilisateurs
        ));
    }
    
47
}