php – 订单日期查询,语法错误
发布时间:2020-12-13 17:50:04 所属栏目:PHP教程 来源:网络整理
导读:我想使用以下查询来排序商店下订单的日期.我想按升序执行它们但是当我尝试测试运行时,我收到以下错误: [Syntax Error] line 0,col 7: Error: Expected IdentificationVariable | ScalarExpression | AggregateExpression | FunctionDeclaration | PartialOb
我想使用以下查询来排序商店下订单的日期.我想按升序执行它们但是当我尝试测试运行时,我收到以下错误:
$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 )); 解决方法
在createQueryBuilder中使用单词顺序时出错(‘order’)
改变顺序 至 只是o例如createQueryBuilder(‘o’) 结果: $orderSales = $this->getDoctrine()->getRepository("AppBundle:Order")->createQueryBuilder('o'); $orderSales->orderBy('o.date','asc'); $orderSales = $orderSales->getQuery(); $orderResult = $orderSales->getResult(); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |