本文整理汇总了PHP中ContactsUtil::getContactStateDataKeyedById方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactsUtil::getContactStateDataKeyedById方法的具体用法?PHP ContactsUtil::getContactStateDataKeyedById怎么用?PHP ContactsUtil::getContactStateDataKeyedById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactsUtil
的用法示例。
在下文中一共展示了ContactsUtil::getContactStateDataKeyedById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testContactsUtilGetContactStateDataKeyedById
public function testContactsUtilGetContactStateDataKeyedById()
{
$contactStatesData = ContactsUtil::getContactStateDataKeyedById();
$state1 = ContactState::getByName('New');
$state3 = ContactState::getByName('Recycled');
$state4 = ContactState::getByName('Dead');
$state5 = ContactState::getByName('Qualified');
$state6 = ContactState::getByName('Customer');
$state7 = ContactState::getByName('Novo Hermão');
$compareData = array($state1[0]->id => 'New', $state3[0]->id => 'Recycled', $state4[0]->id => 'Dead', $state5[0]->id => 'Qualified', $state6[0]->id => 'Customer', $state7[0]->id => 'Novo Hermão');
$this->assertEquals($compareData, $contactStatesData);
}
示例2: getCollectionCountData
/**
* Get how many records in the Contact and Lead models have each ContactState selected.
* During testing, it is possible a contact or lead exists with a contact state id that no longer exists.
* In that case, it is ignored from the count.
*/
public function getCollectionCountData()
{
$contactStates = ContactsUtil::getContactStateDataKeyedById();
$stateNameCountData = array();
$idCountData = GroupedAttributeCountUtil::getCountData('Contact', 'state');
foreach ($idCountData as $id => $count) {
if (isset($contactStates[$id])) {
$stateNameCountData[$contactStates[$id]] = $count;
}
}
return $stateNameCountData;
}
示例3: testAttributesToAccount
/**
* @depends testCreateStateValues
*/
public function testAttributesToAccount()
{
Yii::app()->user->userModel = User::getByUsername('super');
$industries = array('Automotive', 'Adult Entertainment', 'Financial Services', 'Mercenaries & Armaments');
$industryFieldData = CustomFieldData::getByName('Industries');
$industryFieldData->serializedData = serialize($industries);
$this->assertTrue($industryFieldData->save());
$user = UserTestHelper::createBasicUser('Bobby');
$contact = new Contact();
$contact->owner = $user;
$contact->title->value = 'Mr.';
$contact->firstName = 'Super';
$contact->lastName = 'Man';
$contact->companyName = 'ABC Company';
$stateIds = ContactsUtil::getContactStateDataKeyedById();
foreach ($stateIds as $stateId => $notUsed) {
$stateToUse = ContactState::getById($stateId);
break;
}
$contact->state = $stateToUse;
//grab first state.
$contact->officePhone = '1234567890';
$contact->officeFax = '1222222222';
$contact->industry->value = $industries[1];
$contact->website = 'http://www.something.com';
$contact->primaryAddress->street1 = '129 Noodle Boulevard';
$contact->primaryAddress->street2 = 'Apartment 6000A';
$contact->primaryAddress->city = 'Noodleville';
$contact->primaryAddress->postalCode = '23453';
$contact->primaryAddress->country = 'The Good Old US of A';
$contact->secondaryAddress->street1 = '25 de Agosto 2543';
$contact->secondaryAddress->street2 = 'Local 3';
$contact->secondaryAddress->city = 'Ciudad de Los Fideos';
$contact->secondaryAddress->postalCode = '5123-4';
$contact->secondaryAddress->country = 'Latinoland';
$this->assertTrue($contact->save());
$id = $contact->id;
unset($contact);
$contact = Contact::getById($id);
$account = new Account();
$account = LeadsUtil::attributesToAccount($contact, $account);
$this->assertTrue($account->save());
$id = $account->id;
unset($account);
$account = Account::getById($id);
$this->assertEquals('ABC Company', $account->name);
$this->assertEquals('1234567890', $account->officePhone);
$this->assertEquals('1222222222', $account->officeFax);
$this->assertEquals('http://www.something.com', $account->website);
$this->assertEquals($industries[1], $account->industry->value);
$this->assertEquals('super', $account->owner->username);
$this->assertEquals('129 Noodle Boulevard', $account->billingAddress->street1);
$this->assertEquals('Apartment 6000A', $account->billingAddress->street2);
$this->assertEquals('Noodleville', $account->billingAddress->city);
$this->assertEquals('23453', $account->billingAddress->postalCode);
$this->assertEquals('The Good Old US of A', $account->billingAddress->country);
$this->assertEquals('25 de Agosto 2543', $account->shippingAddress->street1);
$this->assertEquals('Local 3', $account->shippingAddress->street2);
$this->assertEquals('Ciudad de Los Fideos', $account->shippingAddress->city);
$this->assertEquals('5123-4', $account->shippingAddress->postalCode);
$this->assertEquals('Latinoland', $account->shippingAddress->country);
}