/**
  * Get details.
  *
  * @return array
  */
 public function getNotificationDetails()
 {
     $receiver = $this->getReceiver();
     $workspace = $this->badge->getWorkspace() ? $this->badge->getWorkspace()->getId() : null;
     $notificationDetails = array('workspace' => $workspace, 'badge' => array('id' => $this->badge->getId(), 'name' => $this->badge->getName(), 'slug' => $this->badge->getSlug()), 'receiver' => array('id' => $receiver->getId(), 'publicUrl' => $receiver->getPublicUrl(), 'lastName' => $receiver->getLastName(), 'firstName' => $receiver->getFirstName()));
     return $notificationDetails;
 }
 /**
  * @return array
  */
 public function getData()
 {
     return array('badge' => $this->badge->getId(), 'name' => $this->badge->getName(), 'img' => $this->badge->getWebPath());
 }
 /**
  * To verify if an user obtained the badge.
  *
  *
  * @param int                            $userId id User
  * @param \Icap\BadgeBundle\Entity\Badge $badge
  *
  * @return \Icap\BadgeBundle\Entity\UserBadge
  */
 private function getUserBadge($userId, $badge)
 {
     $em = $this->doctrine->getManager();
     $userBadge = $em->getRepository('IcapBadgeBundle:UserBadge')->findOneBy(array('user' => $userId, 'badge' => $badge->getId()));
     return $userBadge;
 }
 public function findUsersNotAwardedWithBadge(Badge $badge)
 {
     $em = $this->getEntityManager();
     $qb = $em->createQueryBuilder();
     $notIn = $qb->select('IDENTITY(ub.user)')->from('IcapBadgeBundle:Userbadge', 'ub')->where('ub.badge = ?1');
     $qb1 = $em->createQueryBuilder();
     $qb1->select('u')->from('ClarolineCoreBundle:User', 'u')->where($qb1->expr()->notIn('u.id', $notIn->getDQL()))->setParameter(1, $badge->getId());
     return $qb1->getQuery()->getResult();
 }