我要使用以下查询来按门店订购日期。我想按升序执行这些操作,但是当我尝试测试运行此操作时,会出现以下错误:
[语法错误]行0,列7:错误:应为identificationvariable|
scalarexpression aggregateexpression函数声明|
partialobjectexpression(“subselect”)“caseexpression,获取
“订单”

$orderSales = $this->getDoctrine()->getRepository("AppBundle:Order")->createQueryBuilder('order');

    $orderSales->orderBy('order.date', 'asc');
    $orderSales = $orderSales->getQuery();
    $orderResult = $orderSales->getResult();

我确实在.twig模板中呈现OrderResult
return $this->render('admin/store/sales/adminsales.html.twig', array(
                            'orderResult' =>$orderResult
    ));

最佳答案

order中使用单词createQueryBuilder('order')时出错
更改order

只是o例如createQueryBuilder('o')
结果:

$orderSales = $this->getDoctrine()->getRepository("AppBundle:Order")->createQueryBuilder('o');

$orderSales->orderBy('o.date', 'asc');
$orderSales = $orderSales->getQuery();
$orderResult = $orderSales->getResult();

09-16 04:26