本文整理汇总了PHP中Oro\Bundle\EmailBundle\Entity\Email::setSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::setSubject方法的具体用法?PHP Email::setSubject怎么用?PHP Email::setSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EmailBundle\Entity\Email
的用法示例。
在下文中一共展示了Email::setSubject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* {@inheritDoc}
*/
public function load(ObjectManager $manager)
{
$fromEmail = new EmailAddressProxy();
$fromEmail->setEmail(uniqid() . '@gmail.com');
$email = new Email();
$email->setSubject(uniqid())->setFromName(uniqid())->setReceivedAt(new \DateTime())->setSentAt(new \DateTime())->setInternalDate(new \DateTime())->setFromEmailAddress($fromEmail)->setMessageId(uniqid());
$manager->persist($fromEmail);
$manager->persist($email);
$manager->flush();
}
示例2: email
/**
* Create Email entity object
*
* @param string $subject The email subject
* @param string $from The FROM email address, for example: john@example.com or "John Smith" <john@example.c4m>
* @param string|string[]|null $to The TO email address(es).
* Example of email address see in description of $from parameter
* @param \DateTime $sentAt The date/time when email sent
* @param \DateTime $receivedAt The date/time when email received
* @param \DateTime $internalDate The date/time an email server returned in INTERNALDATE field
* @param integer $importance The email importance flag. Can be one of *_IMPORTANCE constants of Email class
* @param string|string[]|null $cc The CC email address(es).
* Example of email address see in description of $from parameter
* @param string|string[]|null $bcc The BCC email address(es).
* Example of email address see in description of $from parameter
* @return Email
*/
public function email($subject, $from, $to, $sentAt, $receivedAt, $internalDate, $importance = Email::NORMAL_IMPORTANCE, $cc = null, $bcc = null)
{
$result = new Email();
$result->setSubject($subject)->setFromName($from)->setFromEmailAddress($this->address($from))->setSentAt($sentAt)->setReceivedAt($receivedAt)->setInternalDate($internalDate)->setImportance($importance);
$this->addRecipients($result, EmailRecipient::TO, $to);
$this->addRecipients($result, EmailRecipient::CC, $cc);
$this->addRecipients($result, EmailRecipient::BCC, $bcc);
$this->batch->addEmail($result);
return $result;
}
示例3: 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;
}
示例4: testSubjectGetterAndSetter
public function testSubjectGetterAndSetter()
{
$entity = new Email();
$entity->setSubject('test');
$this->assertEquals('test', $entity->getSubject());
}
示例5: testSync
public function testSync()
{
$email = new Email();
$email->setSubject('Test email');
$emailBody = new EmailBody();
$emailUser = new EmailUser();
$origin = new TestEmailOrigin();
$folder = new EmailFolder();
$folder->setOrigin($origin);
$emailUser->setOrigin($origin);
$emailUser->addFolder($folder);
$email->addEmailUser($emailUser);
$repo = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\Repository\\EmailRepository')->disableOriginalConstructor()->getMock();
$this->doctrine->expects($this->once())->method('getRepository')->willReturn($repo);
$runCount = 0;
$repo->expects($this->exactly(2))->method('getEmailsWithoutBody')->willReturnCallback(function () use(&$runCount, $email) {
$runCount++;
return $runCount === 1 ? [$email] : [];
});
$loader = $this->getMock('Oro\\Bundle\\EmailBundle\\Provider\\EmailBodyLoaderInterface');
$this->selector->expects($this->once())->method('select')->with($this->identicalTo($origin))->will($this->returnValue($loader));
$loader->expects($this->once())->method('loadEmailBody')->with($this->identicalTo($folder), $this->identicalTo($email), $this->identicalTo($this->em))->will($this->returnValue($emailBody));
$this->em->expects($this->once())->method('persist')->with($this->identicalTo($email));
$this->em->expects($this->once())->method('flush');
$this->em->expects($this->once())->method('clear');
$this->logger->expects($this->exactly(2))->method('notice');
$this->logger->expects($this->never())->method('warning');
$this->synchronizer->sync();
$this->assertSame($emailBody, $email->getEmailBody());
}