本文整理汇总了PHP中Lead::load_relationship方法的典型用法代码示例。如果您正苦于以下问题:PHP Lead::load_relationship方法的具体用法?PHP Lead::load_relationship怎么用?PHP Lead::load_relationship使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lead
的用法示例。
在下文中一共展示了Lead::load_relationship方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
} else {
$lead->assigned_user_name = "seed_max";
}
}
$lead->assigned_user_id = $lead->assigned_user_name . "_id";
}
// If this is a large scale test, switch to the bulk teams 90% of the time.
if ($large_scale_test) {
if (mt_rand(0, 100) < 90) {
$assigned_team = $team_demo_data->get_random_team();
$lead->team_id = $assigned_team;
$lead->assigned_user_id = $account->assigned_user_id;
$lead->assigned_user_name = $assigned_team;
} else {
$teams = $team_demo_data->get_random_teamset();
$lead->load_relationship('teams');
$lead->teams->add($teams);
$lead->assigned_user_id = $account->assigned_user_id;
}
} else {
if (mt_rand(0, 100) < 50) {
$lead->team_id = $lead->billing_address_state == "CA" ? "West" : "East";
$teams = $team_demo_data->get_random_teamset();
$lead->load_relationship('teams');
$lead->teams->add($teams);
} else {
$lead->team_id = $lead->billing_address_state == "CA" ? "West" : "East";
$lead->team_set_id = $lead->team_id;
}
}
$lead->primary_address_postalcode = mt_rand(10000, 99999);
示例2: handleLinking
/**
* handles linking contacts, accounts, etc. to an email
*
* @param object Email bean to be linked against
* @return string contactAddr is the email address of the sender
*/
function handleLinking(&$email)
{
// link email to an User if emails match TO addr
if ($userIds = $this->getRelatedId($email->to_addrs, 'users')) {
$GLOBALS['log']->debug('I-E linking email to User');
// link the user to the email
$email->load_relationship('users');
$email->users->add($userIds);
}
// link email to a Contact, Lead, or Account if the emails match
// give precedence to REPLY-TO above FROM
if (!empty($email->reply_to_email)) {
$contactAddr = $email->reply_to_email;
} else {
$contactAddr = $email->from_addr;
}
// Samir Gandhi : 12/06/07
// This changes has been done because the linking was done only with the from address and
// not with to address
$relationShipAddress = $contactAddr;
if (empty($relationShipAddress)) {
$relationShipAddress .= $email->to_addrs;
} else {
$relationShipAddress = $relationShipAddress . "," . $email->to_addrs;
}
if ($leadIds = $this->getRelatedId($relationShipAddress, 'leads')) {
$GLOBALS['log']->debug('I-E linking email to Lead');
$email->load_relationship('leads');
$email->leads->add($leadIds);
foreach ($leadIds as $leadId) {
$lead = new Lead();
$lead->retrieve($leadId);
$lead->load_relationship('emails');
$lead->emails->add($email->id);
}
}
if ($contactIds = $this->getRelatedId($relationShipAddress, 'contacts')) {
$GLOBALS['log']->debug('I-E linking email to Contact');
// link the contact to the email
$email->load_relationship('contacts');
$email->contacts->add($contactIds);
}
if ($accountIds = $this->getRelatedId($relationShipAddress, 'accounts')) {
$GLOBALS['log']->debug('I-E linking email to Account');
// link the account to the email
$email->load_relationship('accounts');
$email->accounts->add($accountIds);
/* cn: bug 9171 another cause of dying I-E - bad linking
foreach($accountIds as $accountId) {
$GLOBALS['log']->debug('I-E reverse-linking Accounts to Emails');
$acct = new Account();
$acct->retrieve($accountId);
$acct->load_relationship('emails');
$acct->account_emails->add($email->id);
}
*/
}
return $contactAddr;
}
示例3: handleLinking
/**
* handles linking contacts, accounts, etc. to an email
*
* @param object Email bean to be linked against
* @return string contactAddr is the email address of the sender
*/
function handleLinking(&$email)
{
// link email to an User if emails match TO addr
if ($userIds = $this->getRelatedId($email->to_addrs, 'users')) {
$GLOBALS['log']->debug('I-E linking email to User');
// link the user to the email
$email->load_relationship('users');
$email->users->add($userIds);
}
// link email to a Contact, Lead, or Account if the emails match
// give precedence to REPLY-TO above FROM
if (!empty($email->reply_to_email)) {
$contactAddr = $email->reply_to_email;
} else {
$contactAddr = $email->from_addr;
}
if ($leadIds = $this->getRelatedId($contactAddr, 'leads')) {
$GLOBALS['log']->debug('I-E linking email to Lead');
$email->load_relationship('leads');
$email->leads->add($leadIds);
if (!class_exists('Lead')) {
require_once 'modules/Leads/Lead.php';
}
foreach ($leadIds as $leadId) {
$lead = new Lead();
$lead->retrieve($leadId);
$lead->load_relationship('emails');
$lead->emails->add($email->id);
}
}
if ($contactIds = $this->getRelatedId($contactAddr, 'contacts')) {
$GLOBALS['log']->debug('I-E linking email to Contact');
// link the contact to the email
$email->load_relationship('contacts');
$email->contacts->add($contactIds);
}
if ($accountIds = $this->getRelatedId($contactAddr, 'accounts')) {
$GLOBALS['log']->debug('I-E linking email to Account');
// link the account to the email
$email->load_relationship('accounts');
$email->accounts->add($accountIds);
if (!class_exists('Account')) {
require_once 'modules/Accounts/Account.php';
}
/* cn: bug 9171 another cause of dying I-E - bad linking
foreach($accountIds as $accountId) {
$GLOBALS['log']->debug('I-E reverse-linking Accounts to Emails');
$acct = new Account();
$acct->retrieve($accountId);
$acct->load_relationship('emails');
$acct->account_emails->add($email->id);
}
*/
}
return $contactAddr;
}