select users with specific role in fosUserBundle user table.


This is an example.
  $em=$this->getDoctrine()->getRepository('AcmeUserBundle:User');
  $query=$em->createQueryBuilder('u')
  ->where('u.roles like :role')
  ->setParameter('role', '%"ROLE_PROSPECTOR"%')
  ->getQuery();
  $users = $query->getResult();

评论

热门帖子