src/Products/NotificationsBundle/Entity/ContactAttempts/SmsContactAttempt.php line 19

Open in your IDE?
  1. <?php
  2. namespace Products\NotificationsBundle\Entity\ContactAttempts;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Products\NotificationsBundle\Entity\AbstractContactAttempt;
  5. use Products\NotificationsBundle\Entity\Recipients\PhoneRecipient;
  6. /**
  7.  * Class SmsContactAttempt
  8.  * @package Products\NotificationsBundle\Entity\ContactAttepmts
  9.  *
  10.  * @method PhoneRecipient getRecipient()
  11.  *
  12.  * @ORM\Entity(
  13.  *     repositoryClass = "Products\NotificationsBundle\Doctrine\Repository\ContactAttempts\SmsContactAttemptRepository",
  14.  * )
  15.  */
  16. class SmsContactAttempt extends AbstractTransactionalContactAttempt
  17. {
  18.     const DISCR 'sms';
  19.     /**
  20.      * @see https://support.twilio.com/hc/en-us/articles/223134347-What-are-the-Possible-SMS-and-MMS-Message-Statuses-and-What-do-They-Mean-
  21.      * @see https://www.twilio.com/docs/sms/api/message-resource#message-status-values
  22.      */
  23.     const STATUSES = [
  24.         ...self::PENDING_STATUSES,
  25.         ...self::SUCCESSFUL_STATUSES,
  26.         ...self::FAILED_STATUSES,
  27.     ];
  28.     const PENDING_STATUSES = [
  29.         ...AbstractContactAttempt::PENDING_STATUSES,
  30.         'sms.accepted',
  31.         'sms.scheduled',
  32.         'sms.queued',
  33.         'sms.sending',
  34.         'sms.sent',
  35.         'sms.delivery_unknown',
  36.     ];
  37.     const SUCCESSFUL_STATUSES = [
  38.         ...AbstractContactAttempt::SUCCESSFUL_STATUSES,
  39.         'sms.delivered',
  40.     ];
  41.     const FAILED_STATUSES = [
  42.         ...AbstractContactAttempt::FAILED_STATUSES,
  43.         'sms.blocked',
  44.         'sms.undelivered',
  45.         'sms.failed',
  46.     ];
  47.     /**
  48.      * @var string|null
  49.      *
  50.      * @ORM\Column(
  51.      *     type = "string",
  52.      *     nullable = true,
  53.      * )
  54.      */
  55.     protected ?string $code null;
  56.     /**
  57.      * @return string|null
  58.      */
  59.     public function getCode(): ?string
  60.     {
  61.         return $this->code;
  62.     }
  63.     /**
  64.      * @param string|null $code
  65.      * @return $this
  66.      */
  67.     public function setCode(?string $code): self
  68.     {
  69.         $this->code $code ?: null;
  70.         return $this;
  71.     }
  72. }