本文整理汇总了PHP中MarketingList::save方法的典型用法代码示例。如果您正苦于以下问题:PHP MarketingList::save方法的具体用法?PHP MarketingList::save怎么用?PHP MarketingList::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarketingList
的用法示例。
在下文中一共展示了MarketingList::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAtleastNameIsRequired
public function testAtleastNameIsRequired()
{
$marketingList = new MarketingList();
$this->assertFalse($marketingList->save());
$errors = $marketingList->getErrors();
$this->assertNotEmpty($errors);
$this->assertCount(1, $errors);
$this->assertEquals(array('name'), array_keys($errors));
}
示例2: actionLoadCampaignWithAllItemActivityTypes
/**
* Special method to load a campaign with all types of campaignItemActivity
*/
public function actionLoadCampaignWithAllItemActivityTypes()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
$emailBox = EmailBoxUtil::getDefaultEmailBoxByUser(Yii::app()->user->userModel);
$marketingList = new MarketingList();
$marketingList->name = 'Demo Marketing List';
$marketingList->save();
$campaign = new Campaign();
$campaign->marketingList = $marketingList;
$campaign->name = 'Campaign with all campaignItemActivity';
$campaign->subject = 'Demo for all types of campaignItemActivities';
$campaign->status = Campaign::STATUS_COMPLETED;
$campaign->sendOnDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$campaign->supportsRichText = true;
$campaign->htmlContent = 'Demo content';
$campaign->fromName = 'Zurmo';
$campaign->fromAddress = 'zurmo@zurmo.org';
$campaign->enableTracking = true;
$saved = $campaign->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
$contacts = Contact::getAll();
//Awaiting queue
$contact = $contacts[0];
$campaignItem = new CampaignItem();
$campaignItem->processed = true;
$campaignItem->campaign = $campaign;
$campaignItem->contact = $contact;
$campaignItem->unrestrictedSave();
//Contact is not subscribed
$contact = $contacts[1];
$marketingList->addNewMember($contact->id, true);
$campaignItem = new CampaignItem();
$campaignItem->processed = true;
$campaignItem->campaign = $campaign;
$campaignItem->contact = $contact;
$activity = new CampaignItemActivity();
$activity->person = $contact;
$activity->campaignItem = $campaignItem;
$activity->quantity = 1;
$activity->type = CampaignItemActivity::TYPE_SKIP;
$activity->save();
$campaignItem->unrestrictedSave();
//Skipped, both primary and secondary are opted out
$contact = $contacts[2];
$contact->primaryEmail->emailAddress = $contact->firstName . '1@zurmo.org';
$contact->primaryEmail->optOut = true;
$contact->secondaryEmail->emailAddress = $contact->firstName . '2@zurmo.org';
$contact->secondaryEmail->optOut = true;
$contact->save();
$marketingList->addNewMember($contact->id);
$campaignItem = new CampaignItem();
$campaignItem->processed = true;
$campaignItem->campaign = $campaign;
$campaignItem->contact = $contact;
$activity = new CampaignItemActivity();
$activity->person = $contact;
$activity->campaignItem = $campaignItem;
$activity->quantity = 1;
$activity->type = CampaignItemActivity::TYPE_SKIP;
$activity->save();
$campaignItem->unrestrictedSave();
//Skipped, primary is opted out but secondary is not
$contact = $contacts[3];
$contact->primaryEmail->emailAddress = $contact->firstName . '1@zurmo.org';
$contact->primaryEmail->optOut = true;
$contact->secondaryEmail->emailAddress = $contact->firstName . '2@zurmo.org';
$contact->secondaryEmail->optOut = false;
$contact->save();
$marketingList->addNewMember($contact->id);
$campaignItem = new CampaignItem();
$campaignItem->processed = true;
$campaignItem->campaign = $campaign;
$campaignItem->contact = $contact;
$activity = new CampaignItemActivity();
$activity->person = $contact;
$activity->campaignItem = $campaignItem;
$activity->quantity = 1;
$activity->type = CampaignItemActivity::TYPE_SKIP;
$activity->save();
$campaignItem->unrestrictedSave();
//Skipped, primary and secondary not set
$contact = $contacts[4];
$contact->primaryEmail = null;
$contact->secondaryEmail = null;
$contact->save();
$marketingList->addNewMember($contact->id);
$campaignItem = new CampaignItem();
$campaignItem->processed = true;
$campaignItem->campaign = $campaign;
$campaignItem->contact = $contact;
$activity = new CampaignItemActivity();
$activity->person = $contact;
$activity->campaignItem = $campaignItem;
//.........这里部分代码省略.........