本文整理汇总了PHP中SugarBean::setDefaultTeam方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarBean::setDefaultTeam方法的具体用法?PHP SugarBean::setDefaultTeam怎么用?PHP SugarBean::setDefaultTeam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarBean
的用法示例。
在下文中一共展示了SugarBean::setDefaultTeam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apiSave
/**
* This function handles turning the API's version of a teamset into what we actually store
* @param SugarBean $bean - the bean performing the save
* @param array $params - an array of paramester relevant to the save, which will be an array passed up to the API
* @param string $fieldName - The name of the field to save (the vardef name, not the form element name)
* @param array $properties - Any properties for this field
*/
public function apiSave(SugarBean $bean, array $params, $fieldName, $properties)
{
// Find the primary team id, or the first one, if nothing is set to primary
$teamList = $params[$fieldName];
$ret = $this->fixupTeamList($teamList);
$teamIds = $ret['teamIds'];
$primaryTeamId = $ret['primaryTeamId'];
if (count($teamIds) == 0) {
// There are no teams being set, set the defaults and move on
$bean->setDefaultTeam();
return;
}
if (empty($primaryTeamId)) {
// They didn't specify a primary team, so I'm just going to set it to the first one
$primaryTeamId = $teamIds[0];
}
$bean->team_id = $primaryTeamId;
if ($bean->load_relationship('teams')) {
$bean->teams->replace($teamIds, array(), false);
}
}