My query is doctirne 2. i have a status field in users, private or public. i want to be able to run this query and display all comments where status= public and private only if userid = current logged in user id(which i know, $loggerUserVarID)
$q = $this->em->createQueryBuilder()
->select('c')
->from('\Entities\Comments', 'c')
->leftJoin('c.users', 'u')
->where('status = public') ??? display all public comments but private if it belpongs to the logged in user.?
->setParameter(1, $loggerUserVarID)
->getQuery();
at the moment, i am using an if statement after i get thee results, is there a way to do an if statement inside this query?