Sle*_*eek 0 php doctrine symfony doctrine-orm
我有一个关于symfony学说的片段,它按降序选择数据.尝试将where子句应用于某些等于true的字段是一个问题.以下是我的片段
$results = $this->getDoctrine()->getRepository('RealBundle:Foo')->findBy([], ['id' => 'DESC','active' => true]);
Run Code Online (Sandbox Code Playgroud)
我有一个名为active的字段.检索active为true的所有结果是一个挑战
上述尝试给出了错误
为RealBundle\Entity\Foo #active指定的方向顺序无效
第一个参数是WHERE子句,第二个参数是ORDER.
$results = $this
->getDoctrine()
->getRepository('RealBundle:Foo')
->findBy(['active'=>true], ['id' => 'DESC']);
Run Code Online (Sandbox Code Playgroud)
findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7579 次 |
| 最近记录: |