本文整理汇总了PHP中Account::load_relationship方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::load_relationship方法的具体用法?PHP Account::load_relationship怎么用?PHP Account::load_relationship使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::load_relationship方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute(&$bean)
{
if ($bean->sales_stage == "completed") {
$realty_list = $bean->get_linked_beans("realty_opportunities", "Realty");
if (!empty($bean->contact_id)) {
$contact = new Contact();
$contact->retrieve($bean->contact_id);
foreach ($realty_list as $realty) {
if ($realty->operation == 'rent') {
$contact->load_relationship("realty_contacts_rent");
$contact->realty_contacts_rent->add($realty->id);
} elseif ($realty->operation == 'buying') {
$contact->load_relationship("realty_contacts_buying");
$contact->realty_contacts_buying->add($realty->id);
}
}
}
if (!empty($bean->account_id)) {
$account = new Account();
$account->retrieve($bean->account_id);
foreach ($realty_list as $realty) {
if ($realty->operation == 'rent') {
$account->load_relationship("realty_accounts_rent");
$account->realty_accounts_rent->add($realty->id);
} elseif ($realty->operation == 'buying') {
$account->load_relationship("realty_accounts_buying");
$account->realty_accounts_buying->add($realty->id);
}
}
}
}
}
示例2: setUp
public function setUp()
{
SugarTestHelper::setUp('beanFiles');
SugarTestHelper::setUp('beanList');
SugarTestHelper::setUp('current_user');
$this->_soapURL = $GLOBALS['sugar_config']['site_url'] . '/service/v4_1/soap.php';
parent::_setupTestUser();
parent::setUp();
$this->account = SugarTestAccountUtilities::createAccount();
$this->contact = SugarTestContactUtilities::createContact();
$this->account->load_relationship('contacts');
$this->account->contacts->add($this->contact->id);
}
示例3: testOneToManyRelationshipModule2Modult
/**
* @group 53223
*/
public function testOneToManyRelationshipModule2Modult()
{
$_REQUEST['relate_id'] = $this->parentAccount->id;
$_REQUEST['relate_to'] = $this->relationship->getName();
// create new account
$objAccount = new Account();
$objAccount->name = "AccountBug53223" . $_REQUEST['relate_to'] . time();
$objAccount->save();
SugarTestAccountUtilities::setCreatedAccount(array($objAccount->id));
// Retrieve new data
$this->parentAccount->retrieve($this->parentAccount->id);
$objAccount->retrieve($objAccount->id);
$this->parentAccount->load_relationship($this->relationship->getName());
$objAccount->load_relationship($this->relationship->getName());
// Getting data of subpanel of parent bean
$_REQUEST['module'] = 'Accounts';
$_REQUEST['action'] = 'DetailView';
$_REQUEST['record'] = $this->parentAccount->id;
$_SERVER['REQUEST_METHOD'] = 'GET';
unset($GLOBALS['focus']);
$subpanels = new SubPanelDefinitions($this->parentAccount, 'Accounts');
$subpanelDef = $subpanels->load_subpanel($this->relationship->getName() . 'accounts_ida');
$subpanel = new SubPanel('Accounts', $this->parentAccount->id, 'default', $subpanelDef);
$subpanel->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
$subpanel->display();
$actual = $this->getActualOutput();
$this->assertContains($objAccount->name, $actual, 'Account name is not displayed in subpanel of parent account');
ob_clean();
// Getting data of subpanel of child bean
$_REQUEST['module'] = 'Accounts';
$_REQUEST['action'] = 'DetailView';
$_REQUEST['record'] = $objAccount->id;
$_SERVER['REQUEST_METHOD'] = 'GET';
unset($GLOBALS['focus']);
$subpanels = new SubPanelDefinitions($objAccount, 'Accounts');
$subpanelDef = $subpanels->load_subpanel($this->relationship->getName() . 'accounts_ida');
$subpanel = new SubPanel('Accounts', $objAccount->id, 'default', $subpanelDef);
$subpanel->setTemplateFile('include/SubPanel/SubPanelDynamic.html');
$subpanel->display();
$actual = $this->getActualOutput();
$this->assertNotContains($this->parentAccount->name, $actual, 'Parent account name is displayed in subpanel of child aaccount');
}
示例4:
$account->assigned_user_name = "seed_max";
}
$account->assigned_user_id = $account->assigned_user_name . "_id";
}
// If this is a large scale test, switch to the bulk teams 90% of the time.
if ($large_scale_test) {
$assigned_team = $team_demo_data->get_random_team();
$account->assigned_user_id = $account->team_id;
$account->assigned_user_name = $assigned_team;
if (mt_rand(0, 100) < 90) {
$account->team_id = $assigned_team;
$account->team_set_id = $account->team_id;
} else {
$account->team_id = $assigned_team;
$teams = $team_demo_data->get_random_teamset();
$account->load_relationship('teams');
$account->teams->add($teams);
}
} else {
if (mt_rand(0, 100) < 50) {
$account->team_id = $account->billing_address_state == "CA" ? "West" : "East";
$teams = $team_demo_data->get_random_teamset();
$account->load_relationship('teams');
$account->teams->add($teams);
} else {
$account->team_id = $account->billing_address_state == "CA" ? "West" : "East";
$account->team_set_id = $account->team_id;
}
}
$account->billing_address_postalcode = mt_rand(10000, 99999);
$account->billing_address_country = 'USA';
示例5: define
/*********************************************************************************
* This code was developed by:
* Audox Ingeniería Ltda.
* You can contact us at:
* Web: www.audox.cl
* Email: info@audox.cl
* Skype: audox.ingenieria
********************************************************************************/
if (!defined('sugarEntry')) {
define('sugarEntry', true);
}
global $app_strings, $app_list_strings;
$account = new Account();
if (!is_null($account->retrieve($_REQUEST['account_id']))) {
$account->load_relationship('opportunities');
$sales_stage = array();
foreach ($app_list_strings['sales_stage_dom'] as $key => $value) {
$sales_stage[$key] = 0;
}
$cols = array();
$cols[] = array("id" => "", "label" => "Proyecto", "pattern" => "", "type" => "string");
$cols[] = array("id" => "", "label" => "Total Abiertos", "pattern" => "", "type" => "number");
foreach ($account->opportunities->getBeans() as $opportunity) {
$sales_stage[$opportunity->sales_stage] = $sales_stage[$opportunity->sales_stage] + $opportunity->amount_usdollar;
}
$rows = array();
foreach ($sales_stage as $key => $value) {
$rows[] = array("c" => array(array("v" => $key, "f" => null), array("v" => $value, "f" => null)));
}
}
示例6: Account
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once 'modules/Accounts/Account.php';
global $mod_strings;
$focus = new Account();
if (!isset($_REQUEST['record'])) {
sugar_die($mod_strings['ERR_DELETE_RECORD']);
}
//populate the account record using the return_id
$focus->retrieve($_REQUEST['return_id']);
$focus->load_relationship('members');
$focus->members->delete($_REQUEST['return_id'], $_REQUEST['record']);
header("Location: index.php?module=" . $_REQUEST['return_module'] . "&action=" . $_REQUEST['return_action'] . "&record=" . $_REQUEST['return_id']);