pagination - Using Knp paginator on symfony 2.3 with weird controller -
i'm using knp paginator on symfony 2.3 project , project new me controllers bit odd use.
i'm trying install there things still blocks making functioning.
i'm following tutorial actually
and here code in controller
private function resultsaction(request $request, user $user, $type, $archive) { $em = $this->getdoctrine()->getmanager(); $results = $em->getrepository("randomrepo")->findbytypeandpro($type, $user, $archive); /** * @var $paginator \knp\component\pager\paginator */ $paginator = $this->get('knp_paginator'); $results = $paginator->paginate( $results, $request->query->getint('page',1), $request->query->getint('limit',5) ); return array("results" => $results, "archive" => $archive); } public function offeraction(user $user, $archive = false) { return $this->resultsaction($user, operation::offer, $archive); } my namespace , class using:
namespace st\backofficebundle\controller; use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\template; use st\userbundle\entity\operation; use st\userbundle\entity\user; use symfony\bundle\frameworkbundle\controller\controller; use symfony\component\httpfoundation\request; and when try load page error:
you forgot add request argument resultsaction call.
declaration contains 4 arguments:
resultsaction(request $request, user $user, $type, $archive) call contains 3:
public function offeraction(user $user, $archive = false) { return $this->resultsaction($user, operation::offer, $archive); } 
Comments
Post a Comment