我正在使用 KnpPaginatorBundle ,我想知道是否可以像这样获取没有别名(t .country)的 url
/travels?sort=country&direction=asc
不像这样
/travels?sort=t.country&direction=asc
这是表格:
<select class="select_styled white_select" id="sort_list" name="option">
<option value="">-------</option>
{{ knp_pagination_sortable(pagination, 'Country A-Z', 't.country', {'sort': 'country', 'direction': 'asc'}) }}
{{ knp_pagination_sortable(pagination, 'Country Z-A', 't.country', {'sort': 'country', 'direction': 'desc'}) }}
</select>
这是控制器:
public function listAction($page, Request $request)
{
$em = $this->getDoctrine()->getManager();
$paginator = $this->get('knp_paginator');
$qb = $em->getRepository('ProjectTravelBundle:Travel')->getListTravelsFrontend();
$pagination = $paginator->paginate(
$qb,
$request->query->get('page', $page)/*page number*/,
10/*limit per page*/
);
return $this->render('ProjectFrontendBundle:Frontend:list.html.twig',array(
'pagination' => $pagination
));
}
没有解决方案 ?