src/EventSubscriber/SmsContactSubscriber.php line 43

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use App\Event\SmsContactEvent;
  4. use App\Service\SmsService;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. class SmsContactSubscriber implements EventSubscriberInterface
  7. {
  8.     /**
  9.      * @var SmsService
  10.      */
  11.     protected $smsService;
  12.  
  13.     public function __construct(SmsService $smsService)
  14.     {
  15.         $this->smsService $smsService;
  16.       
  17.     }
  18.      /**
  19.      * @return array
  20.      */
  21.     public static function getSubscribedEvents():array
  22.     {
  23.         return [
  24.             SmsContactEvent::SEND_SMS_EVENT => [
  25.                 ['onSendSms'1]
  26.             ]
  27.         ];
  28.     }
  29.     /**
  30.      * @param SmsContactEvent $event
  31.      * @throws \Twig\Error\LoaderError
  32.      * @throws \Twig\Error\RuntimeError
  33.      * @throws \Twig\Error\SyntaxError
  34.      */
  35.     public function onSendSms(SmsContactEvent $event)
  36.     {
  37.         $sms $event->getSms();
  38.         $this->smsService->sendSms($sms->getPayItemDescr(), $sms->getPhoneNumber(), $sms->getCallbackUrl(),$sms->getUser(), $sms->getServiceid(),1$sms->getStatus(), $sms->getCustomerId() );
  39.     }
  40.    
  41. }