如何在KNP Paginator中捕获Doctrine \ ORM \ Query \ QueryException?

时间:2015-09-05 17:11:18

标签: symfony doctrine-orm knppaginator

我不希望屏幕上出现这种错误:

  

[语义错误]第0行,第66行附近' ewdd =:para':错误:类   AppBundle \ Entity \ Ksiazka没有名为ewdd的字段或关联

如何在我的控制器中使用KNP Paginator捕获Doctrine \ ORM \ Query \ QueryException?

   $query = $em->createQuery(
        'SELECT a
        FROM AppBundle:Book a
        WHERE a.'.$findby.' = :param'
    )->setParameter('param', $what);

    $paginator  = $this->get('knp_paginator');

    $pagination = $paginator->paginate(
        $query,
        $request->query->getInt('page', 1),45
    );

0 个答案:

没有答案