當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CustomFieldData::save方法代碼示例

本文整理匯總了PHP中CustomFieldData::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP CustomFieldData::save方法的具體用法?PHP CustomFieldData::save怎麽用?PHP CustomFieldData::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CustomFieldData的用法示例。


在下文中一共展示了CustomFieldData::save方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::$freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         self::$freeze = true;
     }
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $currencies = Currency::getAll();
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $multiDropDownCustomFieldData = new CustomFieldData();
     $multiDropDownCustomFieldData->name = 'multiDropDown';
     $multiDropDownCustomFieldData->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData = new CustomFieldData();
     $tagCustomFieldData->name = 'tagCloud';
     $tagCustomFieldData->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail = new Email();
     $primaryEmail->emailAddress = "info@zurmo.com";
     $primaryEmail->isInvalid = true;
     $primaryEmail->optOut = false;
     $secondaryEmail = new Email();
     $secondaryEmail->emailAddress = "jake@zurmo.com";
     $secondaryEmail->isInvalid = false;
     $secondaryEmail->optOut = true;
     $address = new Address();
     $address->street1 = "SomeStreet1";
     $address->street2 = "SomeStreet2";
     $address->city = "SomeCity";
     $address->state = "SomeState";
     $address->postalCode = 1111;
     $address->country = "SomeCountry";
     $likeContactState = new ContactState();
     $likeContactState->name = 'Customer';
     $likeContactState->order = 0;
     $users = User::getAll();
     $user = new User();
     $user->lastName = 'Kevin';
     $user->hash = 'rieWoy3aijohP6chaigaokohs1oovohf';
     $user->language = 'es';
     $user->timeZone = 'America/Chicago';
     $user->username = 'kevinjones';
     $user->currency = $currencies[0];
     $user->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'abc';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail;
     $model->secondaryEmail = $secondaryEmail;
     $model->primaryAddress = $address;
     $model->likeContactState = $likeContactState;
     $model->user = $user;
     $model->multiDropDown->data = $multiDropDownCustomFieldData;
     $model->tagCloud->data = $tagCustomFieldData;
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue1);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue2);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue3);
     $model->tagCloud->values->add($tagCustomFieldValue1);
     $model->tagCloud->values->add($tagCustomFieldValue2);
     $model->customCstm = 'text custom';
//.........這裏部分代碼省略.........
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:101,代碼來源:ContactMergeTagsUtilTest.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // We need to unfreeze here as we are working with custom field values
     self::$freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         self::$freeze = true;
     }
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $currencies = Currency::getAll();
     $currencyValue1 = new CurrencyValue();
     $currencyValue1->value = 100;
     $currencyValue1->currency = $currencies[0];
     $multiDropDownCustomFieldData1 = new CustomFieldData();
     $multiDropDownCustomFieldData1->name = 'multiDropDown1';
     $multiDropDownCustomFieldData1->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData1->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData1 = new CustomFieldData();
     $tagCustomFieldData1->name = 'tagCloud1';
     $tagCustomFieldData1->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData1->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail1 = new Email();
     $primaryEmail1->emailAddress = "info@zurmo.com";
     $primaryEmail1->isInvalid = true;
     $primaryEmail1->optOut = false;
     $secondaryEmail1 = new Email();
     $secondaryEmail1->emailAddress = "jake@zurmo.com";
     $secondaryEmail1->isInvalid = false;
     $secondaryEmail1->optOut = true;
     $address1 = new Address();
     $address1->street1 = "SomeStreet1";
     $address1->street2 = "SomeStreet2";
     $address1->city = "SomeCity";
     $address1->state = "SomeState";
     $address1->postalCode = 1111;
     $address1->country = "SomeCountry";
     $likeContactState1 = new ContactState();
     $likeContactState1->name = 'Customer';
     $likeContactState1->order = 0;
     $users = User::getAll();
     $user1 = new User();
     $user1->lastName = 'Kevin';
     $user1->hash = 'rieWoy3aijohP6chaigaokohs1oovohf';
     $user1->language = 'es';
     $user1->timeZone = 'America/Chicago';
     $user1->username = 'dave';
     $user1->currency = $currencies[0];
     $user1->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'abc';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue1;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail1;
     $model->secondaryEmail = $secondaryEmail1;
     $model->primaryAddress = $address1;
     $model->likeContactState = $likeContactState1;
     $model->user = $user1;
     $model->multiDropDown->data = $multiDropDownCustomFieldData1;
     $model->tagCloud->data = $tagCustomFieldData1;
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue1);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue2);
     $model->multiDropDown->values->add($multiDropDownCustomFieldValue3);
     $model->tagCloud->values->add($tagCustomFieldValue1);
     $model->tagCloud->values->add($tagCustomFieldValue2);
//.........這裏部分代碼省略.........
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:101,代碼來源:WorkflowMergeTagsUtilTest.php

示例3: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     self::$super = User::getByUsername('super');
     Yii::app()->user->userModel = self::$super;
     $loaded = ContactsModule::loadStartingData();
     if (!$loaded) {
         throw new NotSupportedException();
     }
     $emailSignature = new EmailSignature();
     $emailSignature->htmlContent = 'my email signature';
     self::$super->emailSignatures->add($emailSignature);
     self::$super->save();
     $currencies = Currency::getAll();
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $multiDropDownCustomFieldData = new CustomFieldData();
     $multiDropDownCustomFieldData->name = 'multiDropDown';
     $multiDropDownCustomFieldData->serializedData = serialize(array('Ten', 11, 'XII'));
     $saved = $multiDropDownCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $multiDropDownCustomFieldValue1 = new CustomFieldValue();
     $multiDropDownCustomFieldValue1->value = 'Ten';
     $multiDropDownCustomFieldValue2 = new CustomFieldValue();
     $multiDropDownCustomFieldValue2->value = 11;
     $multiDropDownCustomFieldValue3 = new CustomFieldValue();
     $multiDropDownCustomFieldValue3->value = 'XII';
     $tagCustomFieldData = new CustomFieldData();
     $tagCustomFieldData->name = 'tagCloud';
     $tagCustomFieldData->serializedData = serialize(array('Apache', 'PHP'));
     $saved = $tagCustomFieldData->save();
     assert('$saved');
     // Not Coding Standard
     $tagCustomFieldValue1 = new CustomFieldValue();
     $tagCustomFieldValue1->value = 'PHP';
     $tagCustomFieldValue2 = new CustomFieldValue();
     $tagCustomFieldValue2->value = 'Apache';
     $primaryEmail = new Email();
     $primaryEmail->emailAddress = "info@zurmo.com";
     $primaryEmail->isInvalid = true;
     $primaryEmail->optOut = false;
     $secondaryEmail = new Email();
     $secondaryEmail->emailAddress = "jake@zurmo.com";
     $secondaryEmail->isInvalid = false;
     $secondaryEmail->optOut = true;
     $address = new Address();
     $address->street1 = "SomeStreet1";
     $address->street2 = "SomeStreet2";
     $address->city = "SomeCity";
     $address->state = "SomeState";
     $address->postalCode = 1111;
     $address->country = "SomeCountry";
     $likeContactState = new ContactState();
     $likeContactState->name = 'Customer';
     $likeContactState->order = 0;
     static::$hash = StringUtil::generateRandomString(60);
     $users = User::getAll();
     $user = new User();
     $user->lastName = 'Kevin';
     $user->hash = static::$hash;
     $user->language = 'es';
     $user->timeZone = 'America/Chicago';
     $user->username = 'kevinjones';
     $user->currency = $currencies[0];
     $user->manager = $users[0];
     //Custom attribute
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom';
     $attributeForm->attributeLabels = array('en' => 'test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     //Custom attribute with underscore and number
     $attributeForm = new TextAttributeForm();
     $attributeForm->attributeName = 'custom_attr_2';
     $attributeForm->attributeLabels = array('en' => 'custom test label en');
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new EmailTemplateModelTestItem());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $model = new EmailTemplateModelTestItem();
     $model->string = 'We will add a $100 discount to this deal';
     $model->firstName = 'James';
     $model->lastName = 'Jackson';
     $model->phone = 1122334455;
     $model->boolean = true;
     $model->date = '2008-12-31';
     $model->dateTime = '2008-12-31 07:48:04';
     $model->textArea = 'Multiple Lines\\nOf Text';
     $model->url = 'http://www.zurmo.com/';
     $model->integer = 999;
     $model->float = 999.999;
     $model->currencyValue = $currencyValue;
     $model->dropDown->value = "DropdownSelectedValue";
     $model->radioDropDown->value = "RadioDropdownSelectedValue";
     $model->primaryEmail = $primaryEmail;
     $model->secondaryEmail = $secondaryEmail;
//.........這裏部分代碼省略.........
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:101,代碼來源:ContactMergeTagsUtilTest.php


注:本文中的CustomFieldData::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。