createQueryBuilder('e') ->where(':newsletter MEMBER OF e.newsletters') ->setParameter('newsletter', $newsletter->getId()) ->getQuery() ->getResult(); } public function findByRole($role) { $qb = $this->createQueryBuilder('u') ->where('u.roles LIKE :roles') ->setParameter('roles', '%"' . $role . '"%'); return $qb->getQuery()->getResult(); } }