src/Products/NotificationsBundle/Controller/System/SendgridWebhookController.php line 27

Open in your IDE?
  1. <?php
  2. namespace Products\NotificationsBundle\Controller\System;
  3. use App\Controller\AbstractController;
  4. use Products\NotificationsBundle\Entity\AbstractNotification;
  5. use Products\NotificationsBundle\Entity\Notifications\Channels\ChannelsInterface;
  6. use Products\NotificationsBundle\Service\ContactMonitor;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. /**
  11.  * @Route(
  12.  *     "/sendgrid",
  13.  * )
  14.  */
  15. final class SendgridWebhookController extends AbstractController
  16. {
  17.     const ROUTES__EMAIL 'app.notifications.system.sendgrid_webhook.email';
  18.     /**
  19.      * @return ContactMonitor|object
  20.      */
  21.     protected function getContactMonitor(): ContactMonitor
  22.     {
  23.         return $this->get(__METHOD__);
  24.     }
  25.     /**
  26.      * @param Request $request
  27.      * @return Response
  28.      *
  29.      * @Route(
  30.      *     "/email",
  31.      *     name = SendgridWebhookController::ROUTES__EMAIL,
  32.      * )
  33.      */
  34.     public function emailAction(Request $request): Response
  35.     {
  36.         $this->getContactMonitor()->queueOrHandleWebhook(ChannelsInterface::CHANNELS__EMAIL$request);
  37.         return new Response();
  38.     }
  39. }