public function storeAction(Request $request) { $this->assertUserRights(UserRole::ROLE_ADMIN); $em = $this->getDoctrine()->getManager(); if ($request->get('configurationId') > 0) { $configuration = $this->getDoctrine()->getRepository('KoalamonNotificationEngineBundle:NotificationConfiguration')->find($request->get('configurationId')); } else { $configuration = new NotificationConfiguration(); $configuration->setNotifyAll(false); } $configuration->setOptions($request->get('options')); $configuration->setSenderType($request->get('senderIdentifier')); $configuration->setProject($this->getProject()); $configuration->setName($request->get('name')); $em->persist($configuration); $em->flush(); return $this->redirectToRoute('koalamon_notification_engine_home', ['project' => $this->getProject()->getIdentifier()]); }
public function storeAction(NotificationConfiguration $notificationConfiguration, Request $request) { $this->assertUserRights(UserRole::ROLE_ADMIN); if ($request->get('notify_all') === "true") { $notificationConfiguration->setNotifyAll(true); $notificationConfiguration->clearConnectedTools(); } else { $notificationConfiguration->setNotifyAll(false); $notificationConfiguration->clearConnectedTools(); foreach ($request->get('tools') as $toolId => $value) { $tool = $this->getDoctrine()->getRepository('BauerIncidentDashboardCoreBundle:Tool')->find((int) $toolId); /** @var Tool $tool */ if ($tool->getProject() == $this->getProject()) { $notificationConfiguration->addConnectedTool($tool); } } } $em = $this->getDoctrine()->getManager(); $em->persist($notificationConfiguration); $em->flush(); return $this->redirectToRoute('koalamon_notification_engine_alerts_home', ['project' => $this->getProject()->getIdentifier()]); }