app/Customize/Controller/VoiceController.php line 75

Open in your IDE?
  1. <?php
  2. namespace Customize\Controller;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Eccube\Controller\AbstractController;
  6. use Eccube\Event\EccubeEvents;
  7. use Eccube\Event\EventArgs;
  8. use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
  9. use Knp\Component\Pager\PaginatorInterface;
  10. use Customize\Entity\Voice;
  11. use Customize\Repository\VoiceRepository;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  14. use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
  15. use Eccube\Util\CacheUtil;
  16. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  17. class VoiceController extends AbstractController
  18. {
  19.     /**
  20.      * @var VoiceRepository
  21.      */
  22.     protected $voiceRepository;
  23.     /**
  24.      * VoiceController constructor.
  25.      *
  26.      * @param VoiceRepository $voiceRepository
  27.      */
  28.     public function __construct(VoiceRepository $voiceRepository)
  29.     {
  30.         $this->voiceRepository $voiceRepository;
  31.     }
  32.     /**
  33.      * @Route("/voice", name="voice", methods={"GET"})
  34.      * @Template("voice.twig")
  35.      */
  36.     public function index(Request $requestPaginatorInterface $paginator)
  37.     {
  38.         $qb $this->voiceRepository->getQueryBuilderAll();
  39.         $event = new EventArgs(
  40.             [
  41.                 'qb' => $qb,
  42.             ],
  43.             $request
  44.         );
  45.         $pagination $paginator->paginate(
  46.             $qb,
  47.             $request->get('pageno'1),
  48.             $this->eccubeConfig['eccube_voice_pmax'],
  49.             ['wrap-queries' => true]
  50.         );
  51.         return [
  52.             'pagination' => $pagination,
  53.         ];
  54.     }
  55.     /**
  56.      * @Route("/voice-dtl/{id}", name="voice-dtl", methods={"GET"})
  57.      * @Template("voice-dtl.twig")
  58.      *
  59.      * @param Voice $Voice
  60.      *
  61.      * @return array
  62.      */
  63.     public function detail(Voice $Voice)
  64.     {
  65.         return [
  66.             'Voice' => $Voice,
  67.         ];
  68.     }
  69. }