43 public static function fromArray(array $array): self
45 if (!isset($array[self::FIELD_ID], $array[self::FIELD_MAILBOX_ID]))
47 throw new \Bitrix\Main\SystemException(
'message field error');
50 $item =
new self((int)$array[self::FIELD_ID], (
int)$array[self::FIELD_MAILBOX_ID]);
52 $item->msgId = $array[self::FIELD_MSG_ID] ??
'';
53 $item->subject = $array[self::FIELD_SUBJECT] ??
'';
54 $item->body = $array[self::FIELD_BODY] ??
'';
55 $item->bodyHtml = $array[self::FIELD_BODY_HTML] ??
'';
56 $item->from = $array[self::FIELD_FROM] ??
'';
57 $item->to = $array[self::FIELD_TO] ??
'';
58 $date = $array[self::FIELD_DATE] ??
'';
59 $item->date = $date instanceof \Bitrix\Main\Type\DateTime
61 : new \Bitrix\Main\Type\DateTime();
129 self::FIELD_ID => $this->
getId(),
130 self::FIELD_MSG_ID => $this->
getMsgId(),
133 self::FIELD_BODY => $this->
getBody(),
135 self::FIELD_FROM => $this->
getFrom(),
136 self::FIELD_TO => $this->
getTo(),
137 self::FIELD_DATE => $this->
getDate()->format(
'Y-m-d H:i:s'),