I'm using Knp paginator on a symfony 2.3 project and the project is new to me so the controllers are a bit odd to use.
I'm trying to install it but there is things that still blocks from making it functioning.
I'm following this tutorial actually
and here is my code in my 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 and 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 so when I try to load my page I get this error:
You forgot to add Request argument into 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);
}