Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1.  
  2.  
  3. use Symfony\Component\Form\Extension\Core\Type\HiddenType;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\HttpFoundation\Response\json;
  7. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  8. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  9. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  10. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  11. use FOS\RestBundle\View\View;
  12. use FOS\RestBundle\Controller\Annotations as FOSRest;
  13. use FOS\RestBundle\Controller\FOSRestController;
  14. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  15. use Symfony\Component\HttpFoundation\JsonResponse;
  16. use App\Repository\BusinessRepository;
  17. use App\Entity\BusinessPaymentMethod;
  18. use App\Entity\Business;
  19. class BusinessPaymentMethodC
  20. public function getAction()
  21. {
  22. $request = Request::createFromGlobals();
  23.  
  24. $limit = $request->query->get('limit');
  25.  
  26. $paymentmethods = $this->getDoctrine()->getRepository(BusinessPaymentMethod::class)->findAll(array(),array('name' => 'asc'),$limit);
  27.  
  28. if($paymentmethods === null){
  29. $paymentmethodsView = new View(null, Response::HTTP_NOT_FOUND);
  30. }else{
  31. $paymentmethodsView = new View($paymentmethods);
  32. }
  33.  
  34. $paymentmethodsView->setFormat('json');
  35. return $this->handleView($paymentmethodsView);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement