Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的控制器中有代码:
$categories = $this->getDoctrine()->getRepository('MyBundle:Categories')->findAll();
默认情况下,这会从我的表中返回所有数据,但我只想返回列“cenzored”为0的记录。如果不创建另一个实体,我该怎么做?
我的表看起来:
cid | integer | auto_increment name | varchar(50) cenzored | boolean
改用并使用数组findBy为 - 子句添加一些信息:WHERE
findBy
WHERE
[…]->findBy(array('cenzored' => false));