<?php
namespace Customize\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
use Eccube\Controller\AbstractController;
use Eccube\Event\EccubeEvents;
use Eccube\Event\EventArgs;
use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
use Knp\Component\Pager\PaginatorInterface;
use Customize\Entity\Voice;
use Customize\Repository\VoiceRepository;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
use Eccube\Util\CacheUtil;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
class VoiceController extends AbstractController
{
/**
* @var VoiceRepository
*/
protected $voiceRepository;
/**
* VoiceController constructor.
*
* @param VoiceRepository $voiceRepository
*/
public function __construct(VoiceRepository $voiceRepository)
{
$this->voiceRepository = $voiceRepository;
}
/**
* @Route("/voice", name="voice", methods={"GET"})
* @Template("voice.twig")
*/
public function index(Request $request, PaginatorInterface $paginator)
{
$qb = $this->voiceRepository->getQueryBuilderAll();
$event = new EventArgs(
[
'qb' => $qb,
],
$request
);
$pagination = $paginator->paginate(
$qb,
$request->get('pageno', 1),
$this->eccubeConfig['eccube_voice_pmax'],
['wrap-queries' => true]
);
return [
'pagination' => $pagination,
];
}
/**
* @Route("/voice-dtl/{id}", name="voice-dtl", methods={"GET"})
* @Template("voice-dtl.twig")
*
* @param Voice $Voice
*
* @return array
*/
public function detail(Voice $Voice)
{
return [
'Voice' => $Voice,
];
}
}