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


PHP Email::getRecipients方法代码示例

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


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

示例1: testRecipientGetterAndSetter

 public function testRecipientGetterAndSetter()
 {
     $toRecipient = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailRecipient');
     $toRecipient->expects($this->any())->method('getType')->will($this->returnValue('to'));
     $ccRecipient = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailRecipient');
     $ccRecipient->expects($this->any())->method('getType')->will($this->returnValue('cc'));
     $bccRecipient = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailRecipient');
     $bccRecipient->expects($this->any())->method('getType')->will($this->returnValue('bcc'));
     $entity = new Email();
     $entity->addRecipient($toRecipient);
     $entity->addRecipient($ccRecipient);
     $entity->addRecipient($bccRecipient);
     $recipients = $entity->getRecipients();
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $recipients);
     $this->assertCount(3, $recipients);
     $this->assertTrue($toRecipient === $recipients[0]);
     $this->assertTrue($ccRecipient === $recipients[1]);
     $this->assertTrue($bccRecipient === $recipients[2]);
     /** @var GroupNodeDefinition $recipients */
     $recipients = $entity->getRecipients('to');
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $recipients);
     $this->assertCount(1, $recipients);
     $this->assertTrue($toRecipient === $recipients->first());
     $recipients = $entity->getRecipients('cc');
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $recipients);
     $this->assertCount(1, $recipients);
     $this->assertTrue($ccRecipient === $recipients->first());
     $recipients = $entity->getRecipients('bcc');
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $recipients);
     $this->assertCount(1, $recipients);
     $this->assertTrue($bccRecipient === $recipients->first());
 }
开发者ID:xamin123,项目名称:platform,代码行数:32,代码来源:EmailTest.php

示例2: getEmails

 /**
  * Gets all(FROM, TO, CC, BCC) emails.
  *
  * @param Email $email
  *
  * @return string[]
  */
 protected function getEmails(Email $email)
 {
     $emails = [];
     foreach ($email->getRecipients() as $recipient) {
         $emails[] = $recipient->getEmailAddress()->getEmail();
     }
     $emails[] = $email->getFromEmailAddress()->getEmail();
     return array_unique($emails);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:EmailActivitySuggestionApiEntityManager.php

示例3: addRecipientOwners

 /**
  * @param array $targets
  * @param Email $email
  */
 protected function addRecipientOwners(&$targets, Email $email)
 {
     $recipients = $email->getRecipients();
     foreach ($recipients as $recipient) {
         $owner = $recipient->getEmailAddress()->getOwner();
         if ($owner) {
             $this->addTarget($targets, $owner);
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:14,代码来源:EmailActivityManager.php

示例4: processRecipients

 /**
  * @param Email    $email
  * @param string   $type
  * @param string[] $recipients
  */
 protected function processRecipients(Email $email, $type, array $recipients)
 {
     if ($email->getId()) {
         $existingRecipients = $email->getRecipients($type);
         if (!$this->areRecipientsEqual($existingRecipients, $recipients)) {
             throw $this->createInvalidPropertyException(sprintf('"%s" recipients', $type), $this->convertRecipientsToString($existingRecipients), $this->convertRecipientsToString($recipients));
         }
     } else {
         foreach ($recipients as $recipient) {
             $email->addRecipient($this->emailEntityBuilder->recipient($type, $recipient));
         }
     }
 }
开发者ID:nmallare,项目名称:platform,代码行数:18,代码来源:EmailApiHandler.php


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