app/Plugin/PayPalCheckout42/Controller/Admin/PaymentStatus/TransactionController.php line 44

Open in your IDE?
  1. <?php
  2. namespace Plugin\PayPalCheckout42\Controller\Admin\PaymentStatus;
  3. use Eccube\Controller\AbstractController;
  4. use Knp\Component\Pager\PaginatorInterface;
  5. use Plugin\PayPalCheckout42\Form\Type\Admin\PaymentStatus\TransactionConditionType;
  6. use Plugin\PayPalCheckout42\Repository\TransactionRepository;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  8. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  9. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  10. use Symfony\Component\HttpFoundation\Request;
  11. /**
  12.  * Class TransactionController
  13.  * @package Plugin\PayPalCheckout42\Controller\Admin\PaymentStatus
  14.  */
  15. class TransactionController extends AbstractController
  16. {
  17.     /**
  18.      * @var TransactionRepository
  19.      */
  20.     protected $transactionRepository;
  21.     /**
  22.      * PaymentStatusController constructor.
  23.      * @param TransactionRepository $transactionRepository
  24.      */
  25.     public function __construct(
  26.         TransactionRepository $transactionRepository
  27.     ) {
  28.         $this->transactionRepository $transactionRepository;
  29.     }
  30.     /**
  31.      * @Route("/%eccube_admin_route%/paypal/payment_status", name="paypal_admin_payment_status")
  32.      * @Route("/%eccube_admin_route%/paypal/payment_status/{page_no}", requirements={"page_no" = "\d+"}, name="paypal_admin_payment_status_page")
  33.      * @Template("@PayPalCheckout42/admin/payment_status.twig")
  34.      * @param Request $request
  35.      * @param PaginatorInterface $paginator
  36.      * @param int $page_no
  37.      * @return array
  38.      */
  39.     public function index(Request $request$page_no nullPaginatorInterface $paginator)
  40.     {
  41.         $page_no $page_no ?? 1;
  42.         $searchForm $this->createForm(TransactionConditionType::class);
  43.         $qb $this->transactionRepository->findBy(
  44.             [],
  45.             ['id' => 'DESC']
  46.         );
  47.         $pagination $paginator->paginate(
  48.             $qb,
  49.             $page_no,
  50.             20
  51.         );
  52.         return [
  53.             'searchForm' => $searchForm->createView(),
  54.             'pagination' => $pagination,
  55.             'has_errors' => false,
  56.         ];
  57.     }
  58. }