/**
  * {@inheritDoc}
  */
 public function getGroupusers()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getGroupusers', array());
     return parent::getGroupusers();
 }
Пример #2
0
 public function registerGroupMailAction(Request $request)
 {
     $successFlag = 0;
     $screenName = 'group mails';
     $session = $request->getSession();
     $em = $this->getDoctrine()->getManager();
     $roleId = $session->get('userRole');
     $action_entity = $em->getRepository('VlreleasesUserBundle:Actions')->findOneBy(array("screenName" => $screenName));
     $userData['rolePermission'] = $em->getRepository('VlreleasesUserBundle:RolesPermissions')->findOneBy(array("role" => $roleId, 'actions' => $action_entity->getId()));
     $uId = $session->get('userId');
     $mails = $request->get('mailsArray');
     $email = $request->get('gEmail');
     $flag = $em->getRepository('VlreleasesUserBundle:GroupEmails')->findOneBy(array("groupEmail" => $email));
     if ($flag == null) {
         $gEmails = new GroupEmails();
         $gEmails->setGroupEmail($request->get('gEmail'));
         $gEmails->setCreatedBy($uId);
         $dbGid = $this->get('GroupMailsService')->save($gEmails);
         $grp = $em->getRepository('VlreleasesUserBundle:GroupEmails')->findOneBy(array("id" => $dbGid));
         if ($dbGid) {
             for ($i = 0; $i < count($mails); $i++) {
                 $gEmailUsers = new GroupmailUsers();
                 $gEmailUsers->setGroup($grp);
                 $user = $em->getRepository('VlreleasesUserBundle:User')->findOneBy(array("email" => $mails[$i]));
                 $gEmailUsers->setUserId($user);
                 $em->persist($gEmailUsers);
             }
             $em->flush();
         }
         $successFlag = 1;
         $groupMailsList = $this->get('GroupMailsService')->getGruopMailsData();
         echo $successFlag . '+' . ($template = $this->renderView('VlreleasesUserBundle:User:displaygroupmailsList.html.twig', array('groupMailsList' => $groupMailsList, 'userData' => $userData)));
         exit;
     } else {
         $successFlag = 0;
         $groupMailsList = $this->get('GroupMailsService')->getGruopMailsData();
         echo $successFlag . '+' . ($template = $this->renderView('VlreleasesUserBundle:User:displaygroupmailsList.html.twig', array('groupMailsList' => $groupMailsList, 'userData' => $userData)));
         exit;
     }
 }