Beispiel #1
0
 /**
  * Home page.
  *
  * @param Paginator           $paginator
  * @param PaginatorAttributes $paginatorAttributes
  *
  * @return Response Response
  *
  * @Route(
  *      path = "/{page}",
  *      name = "store_homepage",
  *      methods = {"GET"},
  *      requirements = {
  *          "page" = "\d+",
  *      },
  *      defaults = {
  *          "page" = "1",
  *      },
  * )
  *
  * @PaginatorAnnotation(
  *      attributes = "paginatorAttributes",
  *      class = "elcodi.entity.product.class",
  *      page = "~page~",
  *      limit = "6",
  *      wheres = {
  *          {"x", "enabled", "=", true},
  *          {"x", "showInHome", "=", true},
  *      },
  *      orderBy = {
  *          {"x", "updatedAt", "DESC"},
  *      }
  * )
  *
  */
 public function homeAction(Paginator $paginator, PaginatorAttributes $paginatorAttributes)
 {
     return $this->renderTemplate('Pages:home-view.html.twig', ['products' => $paginator, 'currentPage' => $paginatorAttributes->getCurrentPage(), 'totalPages' => $paginatorAttributes->getTotalPages(), 'limitPerPage' => $paginatorAttributes->getLimitPerPage()]);
 }