<?php
namespace App\EventListener;
use App\Entity\Applicant;
use Boab\CmsBundle\Sms\SMSGatewayInterface;
class SMSMessengerListener
{
private SMSGatewayInterface $smsGateway;
public function __construct(SMSGatewayInterface $smsGateway)
{
$this->smsGateway = $smsGateway;
}
public function onParticipantRegistered(Applicant $applicant):void
{
dump('SMS HIT');
//$participant = $event->getParticipant();
$smsMessenger = $this->smsGateway->create('mnotify');
$smsResponse = $smsMessenger->send($applicant->getTelephoneNumber(), sprintf("Hi %s, We appreciate your participation in the NEIP/World Bank accelerated program.
Your application is being considered, and we'll let you know when it's ready for the next step", $applicant->getFirstName()));
}
}