本文整理汇总了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;
}
}