Skip to content

Commit

Permalink
Merge pull request #51 from chihiro-adachi/knp-pager
Browse files Browse the repository at this point in the history
Knp\Pager
  • Loading branch information
kiy0taka authored Jun 29, 2023
2 parents 3310040 + 49f3462 commit 8415d99
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Eccube\Repository\NewsRepository;
use Eccube\Routing\Annotation\Route;
use Eccube\Util\CacheUtil;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;
use Eccube\Http\Exception\NotFoundHttpException;

Expand Down Expand Up @@ -52,11 +52,11 @@ public function __construct(NewsRepository $newsRepository)
*
* @param Request $request
* @param int $page_no
* @param PaginatorInterface $paginator
* @param Paginator $paginator
*
* @return array
*/
public function index(Request $request, PaginatorInterface $paginator, $page_no = 1)
public function index(Request $request, Paginator $paginator, $page_no = 1)
{
$qb = $this->newsRepository->getQueryBuilderAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
use Eccube\Service\CsvExportService;
use Eccube\Service\MailService;
use Eccube\Util\FormUtil;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Http\Request;
use Eccube\Http\StreamedResponse;
use Eccube\Http\Exception\NotFoundHttpException;
use Eccube\Pager\Paginator;
use Symfony\Contracts\Translation\TranslatorInterface;

class CustomerController extends AbstractController
Expand Down Expand Up @@ -90,7 +90,7 @@ public function __construct(
* @Route("/%eccube_admin_route%/customer/page/{page_no}", requirements={"page_no" = "\d+"}, name="admin_customer_page", methods={"GET", "POST"})
* @Template("@admin/Customer/index.twig")
*/
public function index(Request $request, PaginatorInterface $paginator, $page_no = null)
public function index(Request $request, Paginator $paginator, $page_no = null)
{
$session = $this->session;
$builder = $this->formFactory->createBuilder(SearchCustomerType::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use Eccube\Routing\Annotation\Route;
use Eccube\Security\Core\User\UserPasswordHasher;
use Eccube\Util\StringUtil;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;
use Eccube\Http\Exception\NotFoundHttpException;

Expand Down Expand Up @@ -62,7 +62,7 @@ public function __construct(
* @Route("/%eccube_admin_route%/customer/{id}/edit", requirements={"id" = "\d+"}, name="admin_customer_edit", methods={"GET", "POST"})
* @Template("@admin/Customer/edit.twig")
*/
public function index(Request $request, PaginatorInterface $paginator, UserPasswordHasher $hasher, $id = null)
public function index(Request $request, Paginator $paginator, UserPasswordHasher $hasher, $id = null)
{
$this->entityManager->enableFilter('incomplete_order_status_hidden');
// 編集
Expand Down
11 changes: 6 additions & 5 deletions src/application/Eccube/Controller/Admin/Order/EditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
use Eccube\Service\PurchaseFlow\PurchaseException;
use Eccube\Service\PurchaseFlow\PurchaseFlow;
use Eccube\Service\TaxRuleService;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Pagination;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;
use Eccube\Http\Exception\BadRequestHttpException;
use Eccube\Http\Exception\NotFoundHttpException;
Expand Down Expand Up @@ -410,7 +411,7 @@ public function index(Request $request, Router $router, $id = null)
*
* @return array
*/
public function searchCustomerHtml(Request $request, PaginatorInterface $paginator, $page_no = null)
public function searchCustomerHtml(Request $request, Paginator $paginator, $page_no = null)
{
if ($request->isXmlHttpRequest() && $this->isTokenValid()) {
log_debug('search customer start.');
Expand Down Expand Up @@ -449,7 +450,7 @@ public function searchCustomerHtml(Request $request, PaginatorInterface $paginat
);
$this->eventDispatcher->dispatch($event, EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_CUSTOMER_SEARCH);

/** @var \Knp\Component\Pager\Pagination\SlidingPagination $pagination */
/** @var Pagination $pagination */
$pagination = $paginator->paginate(
$qb,
$page_no,
Expand Down Expand Up @@ -566,7 +567,7 @@ public function searchCustomerById(Request $request)
* @Route("/%eccube_admin_route%/order/search/product/page/{page_no}", requirements={"page_no" = "\d+"}, name="admin_order_search_product_page", methods={"GET", "POST"})
* @Template("@admin/Order/search_product.twig")
*/
public function searchProduct(Request $request, PaginatorInterface $paginator, $page_no = null)
public function searchProduct(Request $request, Paginator $paginator, $page_no = null)
{
if ($request->isXmlHttpRequest() && $this->isTokenValid()) {
log_debug('search product start.');
Expand Down Expand Up @@ -608,7 +609,7 @@ public function searchProduct(Request $request, PaginatorInterface $paginator, $
);
$this->eventDispatcher->dispatch($event, EccubeEvents::ADMIN_ORDER_EDIT_SEARCH_PRODUCT_SEARCH);

/** @var \Knp\Component\Pager\Pagination\SlidingPagination $pagination */
/** @var Pagination $pagination */
$pagination = $paginator->paginate(
$qb,
$page_no,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
use Eccube\Util\FormUtil;
use Eccube\Validator\Constraints as Assert;
use Eccube\Validator\Validator;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Paginator;
use Eccube\Http\RedirectResponse;
use Eccube\Http\Request;
use Eccube\Http\Response;
Expand Down Expand Up @@ -193,7 +193,7 @@ public function __construct(
* @Route("/%eccube_admin_route%/order/page/{page_no}", requirements={"page_no" = "\d+"}, name="admin_order_page", methods={"GET", "POST"})
* @Template("@admin/Order/index.twig")
*/
public function index(Request $request, PaginatorInterface $paginator, $page_no = null)
public function index(Request $request, Paginator $paginator, $page_no = null)
{
$builder = $this->formFactory
->createBuilder(SearchOrderType::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
use Eccube\Http\Response;
use Eccube\Http\StreamedResponse;
use Eccube\ORM\Exception\ForeignKeyConstraintViolationException;
use Eccube\Pager\Paginator;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\CategoryRepository;
use Eccube\Repository\Master\PageMaxRepository;
Expand All @@ -54,7 +55,6 @@
use Eccube\Service\CsvExportService;
use Eccube\Util\CacheUtil;
use Eccube\Util\FormUtil;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Component\Filesystem\Filesystem;

class ProductController extends AbstractController
Expand Down Expand Up @@ -152,7 +152,7 @@ public function __construct(
* @Route("/%eccube_admin_route%/product/page/{page_no}", requirements={"page_no" = "\d+"}, name="admin_product_page", methods={"GET", "POST"})
* @Template("@admin/Product/index.twig")
*/
public function index(Request $request, PaginatorInterface $paginator, $page_no = null)
public function index(Request $request, Paginator $paginator, $page_no = null)
{
$builder = $this->formFactory
->createBuilder(SearchProductType::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Eccube\Repository\Master\PageMaxRepository;
use Eccube\Routing\Annotation\Route;
use Eccube\Util\FormUtil;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct(
*
* @return \Eccube\Http\Response|array
*/
public function index(Request $request, PaginatorInterface $paginator, $page_no = null)
public function index(Request $request, Paginator $paginator, $page_no = null)
{
$session = $request->getSession();
$pageNo = $page_no;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use Eccube\Service\SystemService;
use Eccube\Util\CacheUtil;
use Eccube\Util\FormUtil;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;
use Eccube\Http\Exception\NotFoundHttpException;

Expand Down Expand Up @@ -114,11 +114,11 @@ public function __construct(
*
* @param Request $request
* @param int $page_no
* @param PaginatorInterface $paginator
* @param Paginator $paginator
*
* @return array
*/
public function search(Request $request, PaginatorInterface $paginator, $page_no = null)
public function search(Request $request, Paginator $paginator, $page_no = null)
{
if (empty($this->BaseInfo->getAuthenticationKey())) {
$this->addWarning('admin.store.plugin.search.not_auth', 'admin');
Expand Down
6 changes: 3 additions & 3 deletions src/application/Eccube/Controller/Mypage/MypageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use Eccube\Service\CartService;
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Service\PurchaseFlow\PurchaseFlow;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;
use Eccube\Http\Exception\BadRequestHttpException;
use Eccube\Http\Exception\NotFoundHttpException;
Expand Down Expand Up @@ -142,7 +142,7 @@ public function login(Request $request, AuthenticationUtils $utils)
* @Route("/mypage/", name="mypage", methods={"GET"})
* @Template("Mypage/index.twig")
*/
public function index(Request $request, PaginatorInterface $paginator)
public function index(Request $request, Paginator $paginator)
{
$Customer = $this->getUser();

Expand Down Expand Up @@ -312,7 +312,7 @@ public function order(Request $request, $order_no)
* @Route("/mypage/favorite", name="mypage_favorite", methods={"GET"})
* @Template("Mypage/favorite.twig")
*/
public function favorite(Request $request, PaginatorInterface $paginator)
public function favorite(Request $request, Paginator $paginator)
{
if (!$this->BaseInfo->isOptionFavoriteProduct()) {
throw new NotFoundHttpException();
Expand Down
8 changes: 4 additions & 4 deletions src/application/Eccube/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
use Eccube\Service\CartService;
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Service\PurchaseFlow\PurchaseFlow;
use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Http\Request;
use Eccube\Http\Exception\NotFoundHttpException;
use Eccube\Pager\Pagination;
use Eccube\Pager\Paginator;

class ProductController extends AbstractController
{
Expand Down Expand Up @@ -102,7 +102,7 @@ public function __construct(
* @Route("/products/list", name="product_list", methods={"GET"})
* @Template("Product/list.twig")
*/
public function index(Request $request, PaginatorInterface $paginator)
public function index(Request $request, Paginator $paginator)
{
// Doctrine SQLFilter
if ($this->BaseInfo->isOptionNostockHidden()) {
Expand Down Expand Up @@ -152,7 +152,7 @@ public function index(Request $request, PaginatorInterface $paginator)
$query = $qb->getQuery()
->useResultCache(true, $this->eccubeConfig['eccube_result_cache_lifetime_short']);

/** @var SlidingPagination $pagination */
/** @var Pagination $pagination */
$pagination = $paginator->paginate(
$query,
!empty($searchData['pageno']) ? $searchData['pageno'] : 1,
Expand Down
10 changes: 5 additions & 5 deletions src/application/Eccube/Controller/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
use Eccube\Repository\ProductRepository;
use Eccube\Routing\Annotation\Route;
use Eccube\Routing\Router;
use Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Pagination;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;
use Eccube\Http\Response;
use Eccube\Http\Exception\NotFoundHttpException;
Expand Down Expand Up @@ -77,7 +77,7 @@ public function __construct(
*
* @Route("/sitemap.xml", name="sitemap_xml", methods={"GET"})
*/
public function index(PaginatorInterface $paginator)
public function index(Paginator $paginator)
{
$pageQueryBuilder = $this->pageRepository->createQueryBuilder('p');
$Page = $pageQueryBuilder->select('p')
Expand All @@ -94,7 +94,7 @@ public function index(PaginatorInterface $paginator)
// フロントの商品一覧の条件で商品情報を取得
$ProductListOrder = $this->productListOrderByRepository->find($this->eccubeConfig['eccube_product_order_newer']);
$productQueryBuilder = $this->productRepository->getQueryBuilderBySearchData(['orderby' => $ProductListOrder]);
/** @var SlidingPagination $pagination */
/** @var Pagination $pagination */
$pagination = $paginator->paginate(
$productQueryBuilder,
1,
Expand Down Expand Up @@ -136,7 +136,7 @@ public function category()
*
* @return Response
*/
public function product(Request $request, PaginatorInterface $paginator)
public function product(Request $request, Paginator $paginator)
{
// Doctrine SQLFilter
if ($this->BaseInfo->isOptionNostockHidden()) {
Expand Down
8 changes: 4 additions & 4 deletions src/application/Eccube/Service/CsvExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use Eccube\Repository\ProductRepository;
use Eccube\Repository\ShippingRepository;
use Eccube\Util\FormUtil;
use Knp\Component\Pager\PaginatorInterface;
use Eccube\Pager\Paginator;
use Eccube\Http\Request;

class CsvExportService
Expand Down Expand Up @@ -104,7 +104,7 @@ class CsvExportService
*/
protected $formFactory;

/** @var PaginatorInterface */
/** @var Paginator */
protected $paginator;

/**
Expand All @@ -119,7 +119,7 @@ class CsvExportService
* @param ProductRepository $productRepository
* @param EccubeConfig $eccubeConfig
* @param FormFactory $formFactory
* @param PaginatorInterface $paginator
* @param Paginator $paginator
*/
public function __construct(
EntityManager $entityManager,
Expand All @@ -131,7 +131,7 @@ public function __construct(
ProductRepository $productRepository,
EccubeConfig $eccubeConfig,
FormFactory $formFactory,
PaginatorInterface $paginator
Paginator $paginator
) {
$this->entityManager = $entityManager;
$this->csvRepository = $csvRepository;
Expand Down
Loading

0 comments on commit 8415d99

Please sign in to comment.