You are here

public static function SmsDeliveryReport::convertFromDeliveryReport in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Entity/SmsDeliveryReport.php \Drupal\sms\Entity\SmsDeliveryReport::convertFromDeliveryReport()
  2. 2.1.x src/Entity/SmsDeliveryReport.php \Drupal\sms\Entity\SmsDeliveryReport::convertFromDeliveryReport()

Converts a plain SMS delivery report into an entity.

Parameters

\Drupal\sms\Message\SmsDeliveryReportInterface $sms_report: A plain SMS delivery report.

Return value

\Drupal\sms\Entity\SmsDeliveryReportInterface An SMS delivery report entity that can be saved.

1 call to SmsDeliveryReport::convertFromDeliveryReport()
SmsMessage::postSave in src/Entity/SmsMessage.php
Acts on a saved entity before the insert or update hook is invoked.

File

src/Entity/SmsDeliveryReport.php, line 279

Class

SmsDeliveryReport
Defines the SMS message delivery report entity.

Namespace

Drupal\sms\Entity

Code

public static function convertFromDeliveryReport(StdDeliveryReportInterface $sms_report) {
  if ($sms_report instanceof SmsDeliveryReportInterface) {
    return $sms_report;
  }
  $new = SmsDeliveryReport::create();
  $new
    ->setMessageId($sms_report
    ->getMessageId())
    ->setRecipient($sms_report
    ->getRecipient())
    ->setStatus($sms_report
    ->getStatus())
    ->setStatusMessage($sms_report
    ->getStatusMessage())
    ->setStatusTime($sms_report
    ->getStatusTime());
  return $new;
}