获得了该查询:
$criteria = new \Doctrine\Common\Collections\Criteria();
$criteria
->where($criteria->expr()->eq('collection', $post['id']))
->andWhere($criteria->expr()->eq('path', ''))
->orWhere($criteria->expr()->eq('path', '/'));
执行类似
的查询where collecion = 1 and path = '' or path = '/'
但怎么说:
where collecion = 1 and (path = '' or path = '/')
cu n00n
答案 0 :(得分:1)
试试这个:
$criteria = new \Doctrine\Common\Collections\Criteria();
$criteria
->where($criteria->expr()->eq('collection', $post['id']))
->andWhere(
$criteria->expr()->orX(
$criteria->expr()->eq('path', ''),
$criteria->expr()->eq('path', '/')
)
);
希望这个帮助