vendor/uvdesk/core-framework/Controller/ThreadXHR.php line 19

Open in your IDE?
  1. <?php
  2. namespace Webkul\UVDesk\CoreFrameworkBundle\Controller;
  3. use Symfony\Component\HttpFoundation\Request;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Webkul\UVDesk\CoreFrameworkBundle\Services\TicketService;
  7. class ThreadXHR extends AbstractController
  8. {
  9.     private $ticketService;
  10.     public function __construct(TicketService $ticketService)
  11.     {
  12.         $this->ticketService $ticketService;
  13.     }
  14.     public function listTicketThreadCollectionXHR($ticketId)
  15.     {
  16.         $entityManager $this->getDoctrine()->getManager();
  17.         $request $this->container->get('request_stack')->getCurrentRequest();
  18.         if (true === $request->isXmlHttpRequest()) {
  19.             $ticket $entityManager->getRepository('UVDeskCoreFrameworkBundle:Ticket')->findOneById($ticketId);
  20.             if (!empty($ticket)) {
  21.                 $paginationResponse $this->ticketService->paginateMembersTicketThreadCollection($ticket$request);
  22.     
  23.                 return new Response(json_encode($paginationResponse), 200, ['Content-Type' => 'application/json']);
  24.             }
  25.         }
  26.         
  27.         return new Response(json_encode([]), 404, ['Content-Type' => 'application/json']);
  28.     }
  29.     
  30. }