I have the following function that counts the unanswered questions:
   public function getUnansweredQuestions(Company $company){
        $qb = $this->createQueryBuilder("q");
        $andX = $qb->expr()->andX();
        $andX->add($qb->expr()->isNull("q.answer"));
        $andX->add("user.company = :company");
        $qb->setParameter("company", $company);
        $andX->add($qb->expr()->in("bid.status", ":status"));
        $qb->setParameter("status", [PurchaseBid::STATUS_PUBLISHED, PurchaseBid::STATUS_CLOSED]);
        $qb->leftJoin("q.purchaseBid", "bid");
        $qb->leftJoin("bid.createdBy", "user");
        $qb->where($andX);
        return $qb->getQuery()->getResult();
    }
I need to ask only if there is a question (answered or unanswered). I don't understand the code very well, but a way from this function should be exists.
 
     
    