Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. /**
  2. * @Route("/aplikacja/kontrahenci", name="contractor_index")
  3. *
  4. * @param Request $request
  5. *
  6. * @return \Symfony\Component\HttpFoundation\Response
  7. */
  8. public function contractorAction(Request $request){
  9.  
  10. $user = $this->getUser();
  11.  
  12. if (!$user){
  13. return $this->render('errors/403.html.twig', array(
  14. 'message' => 'Brak dostępu'
  15. ));
  16. }
  17.  
  18. $repo = $this->getDoctrine()->getRepository(Contractor::class);
  19. $contractors = $repo->findBy(array(
  20. 'user' => $user
  21. ));
  22.  
  23. $paginator = $this->get('knp_paginator');
  24. $pagination = $paginator->paginate(is_null($contractors) ? array() : $contractors, $request->get('page', 1), 20);
  25.  
  26. return $this->render('application/contractor/index.html.twig', array(
  27. 'contractors' => $pagination
  28. ));
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement