/** * @Route("/remove/{id}", name="civix_front_superuser_group_remove") * @Method({"POST"}) */ public function removeGroupAction(Group $group) { $entityManager = $this->getDoctrine()->getManager(); /** @var $csrfProvider \Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider */ $csrfProvider = $this->get('form.csrf_provider'); if ($csrfProvider->isCsrfTokenValid('remove_group_' . $group->getId(), $this->getRequest()->get('_token'))) { $slugify = new Slugify(); $groupName = $slugify->slugify($group->getOfficialName(), ''); $mailgun = $this->get('civix_core.mailgun')->listremoveAction($groupName); if ($mailgun['http_response_code'] != 200) { $this->get('session')->getFlashBag()->add('error', 'Something went wrong removing the group from mailgun'); return $this->redirect($this->generateUrl('civix_front_superuser_manage_groups')); } try { $this->get('civix_core.customer_manager')->removeCustomer($group); } catch (\Exception $e) { $this->get('session')->getFlashBag()->add('error', $e->getMessage()); return $this->redirect($this->generateUrl('civix_front_superuser_manage_groups')); } $entityManager->getRepository('CivixCoreBundle:Group')->removeGroup($group); $this->get('session')->getFlashBag()->add('notice', 'Group was removed'); } else { $this->get('session')->getFlashBag()->add('error', 'Something went wrong'); } return $this->redirect($this->generateUrl('civix_front_superuser_manage_groups')); }
public static function toGroupOwnerData(Group $group) { return ['id' => $group->getId(), 'type' => $group->getType(), 'group_type' => $group->getGroupType(), 'official_title' => $group->getOfficialName(), 'avatar_file_path' => $group->getAvatarFileName()]; }
public function sendUserRegistrationSuccessGroup(Group $group, $plainPassword) { $message = $this->createMessage('Group successful registered', $group->getManagerEmail(), 'CivixFrontBundle:Group:email/user_group_registered.html.twig', array('name' => $group->getOfficialName(), 'username' => $group->getUsername(), 'password' => $plainPassword)); $this->mailer->send($message); }
public function getOfficialName() { $this->__load(); return parent::getOfficialName(); }