diff --git a/src/Controller/WebzineController.php b/src/Controller/WebzineController.php index 0fe4b2b..307397c 100755 --- a/src/Controller/WebzineController.php +++ b/src/Controller/WebzineController.php @@ -284,8 +284,8 @@ class WebzineController extends AbstractController $page=$em->getRepository("App:Webzinepage")->find($id); $sets=$em->getRepository($this->entity)->findBy(["set"=>$webzine->getSet()],["order"=>"ASC"]); - $datanext=$this->getDataAllNext($idcat,$id,$webzine); - $dataprev=$this->getDataAllPrev($idcat,$id,$webzine); + $datanext=$this->getDataAllNext($idcat,$page->getOrder(),$webzine); + $dataprev=$this->getDataAllPrev($idcat,$page->getOrder(),$webzine); $pathinfo=pathinfo($page->getIllustration()); @@ -304,17 +304,17 @@ class WebzineController extends AbstractController } - protected function getDataAllNext($idcat,$id,$webzine) + protected function getDataAllNext($idcat,$order,$webzine) { $em = $this->getDoctrine()->getManager(); $data = $em->createQueryBuilder() ->select('e') ->from("App:Webzinepage", 'e') - ->where('e.id>:id') + ->where('e.order>:order') ->andWhere('e.webzine=:idcat') ->orderBy("e.order","ASC") ->getQuery() - ->setParameter("id", $id) + ->setParameter("order", $order) ->setParameter("idcat", $idcat) ->setMaxResults(1) ->getResult(); @@ -348,17 +348,17 @@ class WebzineController extends AbstractController return $data; } - protected function getDataAllPrev($idcat,$id,$webzine) + protected function getDataAllPrev($idcat,$order,$webzine) { $em = $this->getDoctrine()->getManager(); $data = $em->createQueryBuilder() ->select('e') ->from("App:Webzinepage", 'e') - ->where('e.id<:id') + ->where('e.order<:order') ->andWhere('e.webzine=:idcat') ->orderBy("e.order","DESC") ->getQuery() - ->setParameter("id", $id) + ->setParameter("order", $order) ->setParameter("idcat", $idcat) ->setMaxResults(1) ->getResult();