本文整理匯總了PHP中CRM_Core_DAO_Address::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_DAO_Address::find方法的具體用法?PHP CRM_Core_DAO_Address::find怎麽用?PHP CRM_Core_DAO_Address::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Core_DAO_Address
的用法示例。
在下文中一共展示了CRM_Core_DAO_Address::find方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _addAddress
/**
* Create an address for a contact
*
* @param $cid int: contact id
* @param $masterContactId int: set if this is a shared address
*
* @return array
*/
private function _addAddress($cid, $masterContactId = NULL)
{
// Share existing address
if ($masterContactId) {
$dao = new CRM_Core_DAO_Address();
$dao->is_primary = 1;
$dao->contact_id = $masterContactId;
$dao->find(TRUE);
$dao->master_id = $dao->id;
$dao->id = NULL;
$dao->contact_id = $cid;
$dao->is_primary = $this->isPrimary($cid, 'Address');
$dao->location_type_id = $this->getContactType($masterContactId) == 'Organization' ? self::WORK : self::HOME;
$this->_insert($dao);
} else {
$params = array('contact_id' => $cid, 'location_type_id' => $this->getContactType($cid) == 'Organization' ? self::MAIN : self::HOME, 'street_number' => mt_rand(1, 1000), 'street_number_suffix' => ucfirst($this->randomChar()), 'street_name' => $this->randomItem('street_name'), 'street_type' => $this->randomItem('street_type'), 'street_number_postdirectional' => $this->randomItem('address_direction'), 'county_id' => 1);
$params['street_address'] = $params['street_number'] . $params['street_number_suffix'] . " " . $params['street_name'] . " " . $params['street_type'] . " " . $params['street_number_postdirectional'];
if ($params['location_type_id'] == self::MAIN) {
$params['supplemental_address_1'] = $this->randomItem('supplemental_addresses_1');
}
// Hack to add lat/long (limited to USA based addresses)
list($params['country_id'], $params['state_province_id'], $params['city'], $params['postal_code'], $params['geo_code_1'], $params['geo_code_2'], ) = $this->getZipCodeInfo();
$this->_addDAO('Address', $params);
$params['state'] = $this->states[$params['state_province_id']];
return $params;
}
}