/** * @param Notification $notification */ public function dispatchPushMessages(Notification $notification) { $deviceTokens = $this->deviceRepository->getNotificationTokens($notification); foreach ($deviceTokens as $deviceToken) { $pushNotification = $this->createMessage($notification, $deviceToken); $this->notificationsService->send($pushNotification); } }
/** * @param integer $id * * @ApiDoc( * description="Delete Device", * statusCodes={204="Device Deleted"}, * section="Device") * @Route("/api/devices/{id}") * @Method({"DELETE"}) * @return View */ public function deleteAction($id) { $device = $this->deviceRepository->get($id); $this->securityCheck(Permission::WRITE, $device); $this->entityManager->remove($device); $this->entityManager->flush(); return $this->view(array(), 204); }