Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php “我如何与他人建立关系”;“项目”;帐户bean中的bean?SugarCRM_Php_Sugarcrm_Suitecrm - Fatal编程技术网

Php “我如何与他人建立关系”;“项目”;帐户bean中的bean?SugarCRM

Php “我如何与他人建立关系”;“项目”;帐户bean中的bean?SugarCRM,php,sugarcrm,suitecrm,Php,Sugarcrm,Suitecrm,如何使用SugarCRM SugarBean对象(即使用PHP对象而不是直接使用数据库)查找与帐户相关的项目记录 对于我使用的相关联系人: if ($accaunt->load_relationship('contacts')) { $relatedBeans = $account->contacts->getBeans(); } 我想要这样的东西: $relatedBeans = $account->projects->getBeans(); 我对活动

如何使用SugarCRM SugarBean对象(即使用PHP对象而不是直接使用数据库)查找与帐户相关的项目记录

对于我使用的相关联系人:

if ($accaunt->load_relationship('contacts'))
{
    $relatedBeans = $account->contacts->getBeans();
}
我想要这样的东西:

$relatedBeans = $account->projects->getBeans();
我对活动和成员(相关儿童账户)也有同样的问题


谢谢你的帮助

你差不多做到了

<?php
// Assuming $account is a loaded SugarCRM Account record
$account->load_relationship('project');
$projects = $account->project->getBeans();
foreach($projects as $project){
    var_dump($project->name);
}

此外,更完整的文档可在中找到

此示例将处理将相关联系人抓取到帐户的问题。让我们看一下代码

$account = new Account(); 
$account->retrieve($_REQUEST['record']); 
$contacts = $account->get_linked_beans('contacts','Contact'); 

foreach ( $contacts as $contact ) { 
echo "{$contact->name}\n" 
}

PHP什么时候开始使用bean了?@developerwjk我指的是SugarCRM中的sugarBean
$account = new Account(); 
$account->retrieve($_REQUEST['record']); 
$contacts = $account->get_linked_beans('contacts','Contact'); 

foreach ( $contacts as $contact ) { 
echo "{$contact->name}\n" 
}