操作查询生成器 - Symfony - APYGRIDBundle

时间:2016-02-02 00:04:21

标签: php symfony doctrine-orm

我正在尝试查询数据库并将结果显示到Symfony中的APYDataGridBundle。为此,我使用您的示例示例https://github.com/APY/APYDataGridBundle/blob/master/Resources/doc/grid_configuration/manipulate_query.md

尝试一段时间后,我无法向该网格显示查询结果,请找到下面的代码,

$source = new Entity('AppBundle:Entity');
$grid = $this->get('grid');

$conn = $this->get('database_connection');
$qb = $conn->createQueryBuilder();

$qb->select('id');
$qb->from('Entity');

$q = $qb->getSql();
$stmt = $conn->executeQuery($q);
$items_ids = $stmt->fetchAll( );

$source->manipulateQuery($qb);
$grid->setSource($source);

return $grid->getGridResponse('default/grid.html.twig');

0 个答案:

没有答案