src/AppBundle/Controller/Admin/NotificationController.php
/**
     * Creates a add Notification entity.
     *
     * @Route("/send", name="admin_notification_send")
     * @Method({"GET", "POST"})
     *
     * NOTE: the Method annotation is optional, but it's a recommended practice
     * to constraint the HTTP methods each controller responds to (by default
     * it responds to all methods).
     */
Creates a add Notification entity.

the Method annotation is optional, but it's a recommended practice
to constraint the HTTP methods each controller responds to (by default
it responds to all methods).
Creates a add Notification entity . the Method annotation is optional but it ' s a recommended practice to constraint the HTTP methods each controller responds to ( by default it responds to all methods ) .
public function notificationAction(Request $request)
    {
        $notification = new Notification();
        $form = $this->createForm(NotificationType::class, $notification);
        $form->handleRequest($request);
        $notificationService = $this->get(NotificationApiService::class);
        if ($form->isSubmitted() && $form->isValid()) {
            $response = $notificationService->sendNotification($notification);
            if($response['statusCode'] == 200) {
                $this->addFlash('success', ' Notification sent successfully.');
                $notificationService->saveData($notification, $response['responseObject']);
            }
            return $this->redirectToRoute('admin_notification_index');
        }
        return $this->render('admin/notification/notification.html.twig', [
            'form' => $form->createView(),
        ]);
    }
public function notificationAction ( Request $ request ) { $ notification = new Notification ( ) ; $ form = $ this -> createForm ( NotificationType :: class , $ notification ) ; $ form -> handleRequest ( $ request ) ; $ notificationService = $ this -> get ( NotificationApiService :: class ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ response = $ notificationService -> sendNotification ( $ notification ) ; if ( $ response [ 'statusCode' ] == 200 ) { $ this -> addFlash ( 'success' , ' Notification sent successfully.' ) ; $ notificationService -> saveData ( $ notification , $ response [ 'responseObject' ] ) ; } return $ this -> redirectToRoute ( 'admin_notification_index' ) ; } return $ this -> render ( 'admin/notification/notification.html.twig' , [ 'form' => $ form -> createView ( ) , ] ) ; }
Creates a add Notification entity.
Creates a add Notification entity .