當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。