| @@ 39-62 (lines=24) @@ | ||
| 36 | /** |
|
| 37 | * @Route("", name="company_index", methods={"GET"}) |
|
| 38 | */ |
|
| 39 | public function companyIndexAction(Request $request) |
|
| 40 | { |
|
| 41 | /** @var EntityManager $em */ |
|
| 42 | $em = $this->getDoctrine()->getManager(); |
|
| 43 | ||
| 44 | $query = $em->createQuery('SELECT c FROM AppBundle:Company c JOIN AppBundle:User u WITH c.manager = u'); |
|
| 45 | ||
| 46 | $paginator = $this->get('knp_paginator'); |
|
| 47 | $pagination = $paginator->paginate( |
|
| 48 | $query, |
|
| 49 | $request->query->getInt('page', 1), |
|
| 50 | $this->getParameter('page.size'), |
|
| 51 | [ |
|
| 52 | 'defaultSortFieldName' => 'c.name', |
|
| 53 | 'defaultSortDirection' => 'asc' |
|
| 54 | ] |
|
| 55 | ); |
|
| 56 | ||
| 57 | return $this->render('company/company_index.html.twig', [ |
|
| 58 | 'menu_item' => $this->get('app.menu_builders_chain')->getMenuItemByRouteName('company_index'), |
|
| 59 | 'title' => null, |
|
| 60 | 'elements' => $pagination |
|
| 61 | ]); |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @Route("/eliminar/{id}", name="company_delete", methods={"GET", "POST"}) |
|
| @@ 40-64 (lines=25) @@ | ||
| 37 | /** |
|
| 38 | * @Route("/", name="admin_users", methods={"GET"}) |
|
| 39 | */ |
|
| 40 | public function usersIndexAction(Request $request) |
|
| 41 | { |
|
| 42 | /** @var EntityManager $em */ |
|
| 43 | $em = $this->getDoctrine()->getManager(); |
|
| 44 | ||
| 45 | $usersQuery = $em->createQuery('SELECT u FROM AppBundle:User u'); |
|
| 46 | ||
| 47 | $paginator = $this->get('knp_paginator'); |
|
| 48 | $pagination = $paginator->paginate( |
|
| 49 | $usersQuery, |
|
| 50 | $request->query->getInt('page', 1), |
|
| 51 | $this->getParameter('page.size'), |
|
| 52 | [ |
|
| 53 | 'defaultSortFieldName' => 'u.lastName', |
|
| 54 | 'defaultSortDirection' => 'asc' |
|
| 55 | ] |
|
| 56 | ); |
|
| 57 | ||
| 58 | return $this->render('admin/manage_users.html.twig', |
|
| 59 | [ |
|
| 60 | 'menu_item' => $this->get('app.menu_builders_chain')->getMenuItemByRouteName('admin_users'), |
|
| 61 | 'title' => null, |
|
| 62 | 'pagination' => $pagination |
|
| 63 | ]); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @Route("/nuevo", name="admin_user_new", methods={"GET", "POST"}) |
|