findByMerchantQuery() ->leftJoin('e.users','u') ->having('COUNT(u.id) = 0') ->orHaving(':user MEMBER OF e.users') ->andWhere('e.done = 0') ->setParameter('user', $user) ->orderBy('e.dateReminder', 'ASC') ->groupBy('e.id'); return $qb->getQuery()->getResult(); } public function findByEasyAdminConfig($action, $entity, $id = null){ $qb = $this->findByMerchantQuery(); $qb->andWhere('e.done = 0'); $qb->andWhere('e.entityAction LIKE :action'); $qb->andWhere('e.entityName LIKE :entity'); $qb->setParameter('entity', $entity); $qb->setParameter('action', $action); if($id) { $qb->andWhere('e.entityId LIKE :id'); $qb->setParameter('id', $id); } $qb->orderBy('e.dateReminder', 'ASC'); return $qb->getQuery()->getResult(); } }