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