src/Controller/DashboardController.php line 53

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\RequestManager\Application\ApplicationRequestManager;
  4. use App\RequestManager\MerchantRequestManager;
  5. use App\RequestManager\TerminalRequestManager;
  6. use App\RequestManager\Transaction\TransactionV2RequestManager;
  7. use GuzzleHttp\Exception\GuzzleException;
  8. use JsonException;
  9. use Paynetics\Controller\AbstractApiController;
  10. use Paynetics\Exception\ApiException;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\Serializer\Exception\ExceptionInterface;
  13. /**
  14.  * Class DashboardController
  15.  * @package App\Controller
  16.  */
  17. class DashboardController extends AbstractApiController
  18. {
  19.     /**
  20.      * @var ApplicationRequestManager $service
  21.      * @required
  22.      */
  23.     public ApplicationRequestManager $applicationRequestManager;
  24.     /**
  25.      * @var TransactionV2RequestManager
  26.      * @required
  27.      */
  28.     public TransactionV2RequestManager $transactionRequestManager;
  29.     /**
  30.      * @var TerminalRequestManager
  31.      * @required
  32.      */
  33.     public TerminalRequestManager $terminalRequestManager;
  34.     /**
  35.      * @var MerchantRequestManager
  36.      * @required
  37.      */
  38.     public MerchantRequestManager $merchantRequestManager;
  39.     /**
  40.      * @return Response
  41.      * @throws GuzzleException
  42.      * @throws JsonException
  43.      * @throws ApiException
  44.      * @throws ExceptionInterface
  45.      */
  46.     public function index(): Response
  47.     {
  48.         if ($this->isGranted('ROLE_READ_ONLY')) {
  49.             return $this->redirectToRoute('transactions');
  50.         }
  51.         $applications $this->applicationRequestManager->getApplications(1,5);
  52.         $transactions $this->transactionRequestManager->getTransactions(1,5);
  53.         $stores $this->terminalRequestManager->getStores(1,5);
  54.         $merchants $this->merchantRequestManager->getMerchants(1,5);
  55.         return $this->render('dashboard/dashboard.html.twig', [
  56.             'applications' => $applications,
  57.             'transactions' => $transactions,
  58.             'stores' => $stores,
  59.             'merchants' => $merchants,
  60.             'toolbarPage' => 'Dashboard'
  61.         ]);
  62.     }
  63. }