Knp Paging中的错误

时间:2016-08-08 12:27:11

标签: symfony

我是symfony的新手,并尝试将分页与KNP分页相结合。

我正在使用symfony2.8。我在我的控制器中执行了以下代码

    $repository = $this->getDoctrine()->getRepository('AdminBundle:Cmspage');
    $query = $repository->createQueryBuilder('Cmspage')->getQuery();

    $limit =   10; //$setting->getAdminPageLimit();
    //pagination        
    $paginator = $this->container->get('knp_paginator');
    $pagination = $paginator->paginate($query, $this->container->get('request')->query->get('page', 1), $limit);

我收到以下错误

  

捕获致命错误:传递给Knp \ Component \ Pager \ Paginator :: __ construct()的参数1必须是Symfony \ Component \ EventDispatcher \ EventDispatcher的实例,Symfony \ Component \ HttpKernel \ Debug \ TraceableEventDispatcher的实例,被调用在第1423行的E:\ xmapp_5.6 \ htdocs \ elite \ app \ cache \ prod \ appProdDebugProjectContainer.php中定义

0 个答案:

没有答案