I'm trying to get the ChannelGroups where the ChannelGroup has a count of 0 on its relation ChannelGroupUsers.
public function userEmptyChannelGroups()
{
return $this->getEntityManager()
->createQuery(
'SELECT cg
FROM App:ChannelGroup cg
LEFT JOIN cg.channelGroupUsers cgu
WHERE COUNT(cgu) = 0'
)
->getArrayResult();
}
But I keep getting SQLSTATE[HY000]: General error: 1111 Invalid use of group function (500 Internal Server Error)
upon trying the above.
What am I doing wrong?