我有一个问题,我想使用我查询的第一个实体来加载它关联的一对多实体。我遇到的问题是我想将“$campaignLogs”的查询限制为“status”==“public”
下面的示例不起作用,但显示了我想做的事情。我已经发现您不能在数组集合上使用 where(),因为它已经等效地设置或处理了查询。
$em = $this->getDoctrine()->getManager();
$campaign = $em->getRepository('STLDevRPGBundle:Campaign\Campaign')->findOneByTitle($slug);
// This is what doesn't work, I have to change the "get" somehow
// or does this have to be a custom repository function?
$campaignLogs = $campaign->getCampaignLogs()->where(array("status = 'public'"));