获得第一最大值我已经卡住间或在此:的Symfony /原则:从数据库
我想提取的值从我的表“seuils”点'通过用DESC排序列'datevalidite'。
的SQL工作正常:
SELECT points FROM seuils ORDER BY datevalidite DESC
不过,我已经实现了我的Symonfony的控制器代码返回我一个错误:
$dataSeuils = $this->getDoctrine()->getManager();
$seuils = $dataSeuils->createQuery(
'SELECT points
FROM AppBundle:Seuils
ORDER BY datevalidite DESC')->getResult();
而这里的错误消息:
[Syntax Error] line 0, col 53: Error: Expected end of string, got 'BY'
500 Internal Server Error - QueryException
1 linked Exception:
QueryException »
最后,我需要提取我的实体返回的属性点。
但我真的不明白为什么它在phpMyAdmin(SQL)中正常工作,但不在Symfony中。
这里是我的SQL代码snipp创建表:
CREATE TABLE `seuils` (
`points` int(11) NOT NULL,
`datevalidite` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;