当前位置: 首页>>代码示例>>PHP>>正文


PHP Email::setEmailBody方法代码示例

本文整理汇总了PHP中Oro\Bundle\EmailBundle\Entity\Email::setEmailBody方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::setEmailBody方法的具体用法?PHP Email::setEmailBody怎么用?PHP Email::setEmailBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Oro\Bundle\EmailBundle\Entity\Email的用法示例。


在下文中一共展示了Email::setEmailBody方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testReplace

 /**
  * @dataProvider replaceDataProvider
  * @param       $bodyTemplate
  * @param array $attachments
  */
 public function testReplace($bodyTemplate, array $attachments)
 {
     $email = new Email();
     $emailBody = new EmailBody();
     $replacements = [];
     $contentIds = [];
     foreach ($attachments as $attachmentData) {
         $attachment = new EmailAttachment();
         $emailAttachmentContent = new EmailAttachmentContent();
         $emailAttachmentContent->setContent($attachmentData['content'])->setContentTransferEncoding($attachmentData['transfer_encoding']);
         $attachment->setEmbeddedContentId($attachmentData['content_id'])->setContentType($attachmentData['type'])->setContent($emailAttachmentContent);
         $emailBody->addAttachment($attachment);
         $cid = 'cid:' . $attachmentData['content_id'];
         $contentIds[] = $cid;
         if ($attachmentData['replace']) {
             $replacements[] = sprintf('data:%s;base64,%s', $attachmentData['type'], $attachmentData['content']);
         } else {
             $replacements[] = $cid;
         }
     }
     $emailBody->setBodyContent(vsprintf($bodyTemplate, $contentIds));
     $email->setEmailBody($emailBody);
     $event = new EmailBodyLoaded($email);
     $this->listener->replace($event);
     $this->assertEquals($email, $event->getEmail());
     $this->assertEquals(vsprintf($bodyTemplate, $replacements), $event->getEmail()->getEmailBody()->getBodyContent());
 }
开发者ID:ramunasd,项目名称:platform,代码行数:32,代码来源:ReplaceEmbeddedAttachmentsListenerTest.php

示例2: testEnsureEmailBodyCachedForAlreadyCached

 public function testEnsureEmailBodyCachedForAlreadyCached()
 {
     $email = new Email();
     $email->setEmailBody(new EmailBody());
     $this->emailBodySynchronizer->expects($this->never())->method('syncOneEmailBody');
     $this->manager->ensureEmailBodyCached($email);
 }
开发者ID:snorchel,项目名称:platform,代码行数:7,代码来源:EmailCacheManagerTest.php

示例3: testSyncOneEmailBodyForAlreadyCached

 public function testSyncOneEmailBodyForAlreadyCached()
 {
     $email = new Email();
     $email->setEmailBody(new EmailBody());
     $this->selector->expects($this->never())->method('select');
     $this->synchronizer->syncOneEmailBody($email);
 }
开发者ID:snorchel,项目名称:platform,代码行数:7,代码来源:EmailBodySynchronizerTest.php

示例4: testEmailBodyGetterAndSetter

 public function testEmailBodyGetterAndSetter()
 {
     $emailBody = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailBody');
     $entity = new Email();
     $entity->setEmailBody($emailBody);
     $this->assertTrue($emailBody === $entity->getEmailBody());
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:EmailTest.php

示例5: inapplicableEmailsProvider

 public function inapplicableEmailsProvider()
 {
     $date = new \DateTime('now', new \DateTimeZone('UTC'));
     $oldEmailDate = new \DateTime('now', new \DateTimeZone('UTC'));
     $oldEmailDate->sub(\DateInterval::createFromDateString('2 day'));
     $applicableSubjectsAndBodies = [['not empty subject', 'This is email body with offer, sale and won words.', $date], [null, 'This email has nothing.', $date], [null, 'This is email body with sale and won words.', $oldEmailDate]];
     $data = array_map(function ($subjectAndBody) {
         list($subject, $bodyContent, $sentAt) = $subjectAndBody;
         $body = new EmailBody();
         $body->setBodyContent($bodyContent);
         $email = new Email();
         $email->setSubject($subject);
         $email->setEmailBody($body);
         $email->setSentAt($sentAt);
         return [$email];
     }, $applicableSubjectsAndBodies);
     return $data;
 }
开发者ID:2ndkauboy,项目名称:platform,代码行数:18,代码来源:AutoResponseManagerTest.php

示例6: processBodyType

 /**
  * @param Email  $email
  * @param string $type
  */
 protected function processBodyType(Email $email, $type)
 {
     $body = $email->getEmailBody();
     if ($body) {
         if ($email->getId()) {
             if ($body->getBodyIsText() !== ($type === true)) {
                 throw $this->createInvalidPropertyException('Body Type', $this->emailBodyTypeTransformer->transform($body->getBodyIsText()), $this->emailBodyTypeTransformer->transform($type));
             }
         } else {
             $body->setBodyIsText($type === true);
         }
     } else {
         $email->setEmailBody($this->emailEntityBuilder->body('', $type !== true, true));
     }
 }
开发者ID:nmallare,项目名称:platform,代码行数:19,代码来源:EmailApiHandler.php


注:本文中的Oro\Bundle\EmailBundle\Entity\Email::setEmailBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。