我一直在寻找一种在 APYDataGridBundle 网格应该返回但找不到答案的项目列表上设置条件的方法。
有没有办法设置 DQL 查询并将其传递给网格以显示我想要获取的确切查询结果?
这是代码:
public function filteredlistAction(){
// Create simple grid based on the entity
$source = new Entity('ACMEBundle:MyEntity');
// Get a grid instance
$grid = $this->get('grid');
// Attach the source to the grid
$grid->setSource($source);
...
...
**$grid->getColumns()->getColumnById('myentity_filter_column')->setData('the exact value I tried to match');**
// Manage the grid redirection, exports and the response of the controller
return $grid->getGridResponse('ACMEBundle:MyEntity:index_filteredlist.html.twig');
}