本文整理汇总了PHP中EmailMessage::hasErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailMessage::hasErrors方法的具体用法?PHP EmailMessage::hasErrors怎么用?PHP EmailMessage::hasErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailMessage
的用法示例。
在下文中一共展示了EmailMessage::hasErrors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareMessageContent
/**
* Prepare message content.
* @param EmailMessage $emailMessage
* @return string
*/
public static function prepareMessageContent(EmailMessage $emailMessage)
{
$messageContent = null;
if (!($emailMessage->hasErrors() || $emailMessage->hasSendError())) {
$messageContent .= Zurmo::t('EmailMessagesModule', 'Message successfully sent') . "\n";
} else {
$messageContent .= Zurmo::t('EmailMessagesModule', 'Message failed to send') . "\n";
if ($emailMessage->hasSendError()) {
$messageContent .= $emailMessage->error . "\n";
} else {
//todo: refactor to use ZurmoHtml::errorSummary after this supports that method
//todo: supports nested messages better.
$errors = $emailMessage->getErrors();
foreach ($errors as $attributeNameWithErrors) {
foreach ($attributeNameWithErrors as $attributeError) {
if (is_array($attributeError)) {
foreach ($attributeError as $nestedAttributeError) {
$messageContent .= reset($nestedAttributeError) . "\n";
}
} else {
$messageContent .= reset($attributeError) . "\n";
}
}
}
}
}
return $messageContent;
}