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


PHP EmailMessage::getByFolderTypeAndCampaignId方法代码示例

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


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

示例1: testGetByFolderTypeAndCampaignId

 public function testGetByFolderTypeAndCampaignId()
 {
     $countBefore = EmailMessage::getCount();
     $job = new CampaignQueueMessagesInOutboxJob();
     $email = new Email();
     $email->emailAddress = 'demo@zurmo.com';
     $contact = ContactTestHelper::createContactByNameForOwner('contact 02', $this->user);
     $contact->primaryEmail = $email;
     $this->assertTrue($contact->save());
     $marketingList = MarketingListTestHelper::createMarketingListByName('marketingList 02');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList, $contact);
     $campaign = CampaignTestHelper::createCampaign('campaign 02', 'subject', 'text Content', 'Html Content', null, null, null, Campaign::STATUS_PROCESSING, null, 0, $marketingList);
     $processed = 0;
     CampaignItemTestHelper::createCampaignItem($processed, $campaign, $contact);
     $this->assertTrue($job->run());
     $campaignItemsProcessed = CampaignItem::getByProcessedAndCampaignId(1, $campaign->id);
     $this->assertCount(1, $campaignItemsProcessed);
     $countAfter = EmailMessage::getCount();
     $this->assertEquals($countAfter, $countBefore + 1);
     $outboxCount = count(EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_OUTBOX, $campaign->id));
     $this->assertEquals(1, $outboxCount);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:22,代码来源:EmailMessageTest.php

示例2: deleteCampaignItemsForUnsetEmailMessagesIfPausedToggledToActiveStatus

 protected function deleteCampaignItemsForUnsetEmailMessagesIfPausedToggledToActiveStatus()
 {
     if (!isset($this->originalAttributeValues['status']) || $this->originalAttributeValues['status'] != static::STATUS_PAUSED) {
         return;
     }
     $modifiedAttributeKeys = array_keys(array_filter($this->originalAttributeValues));
     $dependentAttributesModified = array_diff($modifiedAttributeKeys, array('name', 'status'));
     $purgeUnsentCampaignItems = !empty($dependentAttributesModified);
     if ($purgeUnsentCampaignItems) {
         $this->deleteUnprocessedCampaignItems();
         $unsetEmailMessagesForCurrentCampaign = EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_OUTBOX, $this->id);
         foreach ($unsetEmailMessagesForCurrentCampaign as $emailMessage) {
             // deleting campaign item should automatically delete any associated data.
             $emailMessage->campaignItem->delete();
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:17,代码来源:Campaign.php

示例3: testSavePurgesUnsetCampaignItemsForPausedToActiveStatusChangeIfNeeded

 public function testSavePurgesUnsetCampaignItemsForPausedToActiveStatusChangeIfNeeded()
 {
     $campaign = CampaignTestHelper::createCampaign('afterSaveDeleteUnsetCampaignItemsTest', 'subject', 'text');
     // 3 items, 1 unprocessed, 1 processed with email in outbox, 1 processed with email in sent.
     $campaignItem = CampaignItemTestHelper::createCampaignItem(1, $campaign);
     $emailMessage = EmailMessageTestHelper::createOutboxEmail(Yii::app()->user->userModel, 'subject', 'html', 'text', 'from', 'from@zurmo.com', 'to', 'to@zurmo.com');
     $campaignItem->emailMessage = $emailMessage;
     $this->assertTrue($campaignItem->unrestrictedSave());
     $campaignItem2 = CampaignItemTestHelper::createCampaignItem(1, $campaign);
     $emailMessage2 = EmailMessageTestHelper::createDraftSystemEmail('subject2', Yii::app()->user->userModel);
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage2->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     $this->assertTrue($emailMessage2->save());
     $campaignItem2->emailMessage = $emailMessage2;
     $this->assertTrue($campaignItem2->unrestrictedSave());
     CampaignItemTestHelper::createCampaignItem(0, $campaign);
     $this->assertCount(2, CampaignItem::getByProcessedAndCampaignId(1, $campaign->id));
     $this->assertCount(1, CampaignItem::getByProcessedAndCampaignId(0, $campaign->id));
     $this->assertCount(1, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_OUTBOX, $campaign->id));
     $this->assertCount(1, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_SENT, $campaign->id));
     // set initial status
     $campaign->status = Campaign::STATUS_PAUSED;
     $this->assertTrue($campaign->save());
     $this->assertCount(2, CampaignItem::getByProcessedAndCampaignId(1, $campaign->id));
     $this->assertCount(1, CampaignItem::getByProcessedAndCampaignId(0, $campaign->id));
     $this->assertCount(1, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_OUTBOX, $campaign->id));
     $this->assertCount(1, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_SENT, $campaign->id));
     // change a non-dependent property, no change in campaign items
     $campaign->status = Campaign::STATUS_ACTIVE;
     $campaign->name = $campaign->name . 'modified';
     $this->assertCount(2, CampaignItem::getByProcessedAndCampaignId(1, $campaign->id));
     $this->assertCount(1, CampaignItem::getByProcessedAndCampaignId(0, $campaign->id));
     $this->assertCount(1, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_OUTBOX, $campaign->id));
     $this->assertCount(1, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_SENT, $campaign->id));
     // reset status
     $campaign->status = Campaign::STATUS_PAUSED;
     $this->assertTrue($campaign->save());
     // change a dependent property, unset should be deleted.
     $campaign->status = Campaign::STATUS_ACTIVE;
     $campaign->subject = $campaign->subject . 'modified';
     $this->assertTrue($campaign->save());
     // deleted: 1 processed with email in outbox, 1 unprocessed.
     $this->assertCount(1, CampaignItem::getByProcessedAndCampaignId(1, $campaign->id));
     $this->assertCount(0, CampaignItem::getByProcessedAndCampaignId(0, $campaign->id));
     $this->assertCount(0, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_OUTBOX, $campaign->id));
     $this->assertCount(1, EmailMessage::getByFolderTypeAndCampaignId(EmailFolder::TYPE_SENT, $campaign->id));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:47,代码来源:CampaignTest.php


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