本文整理汇总了PHP中SugarBean::convertRow方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarBean::convertRow方法的具体用法?PHP SugarBean::convertRow怎么用?PHP SugarBean::convertRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarBean
的用法示例。
在下文中一共展示了SugarBean::convertRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_related_list_by_user_id
/**
* @param SugarBean $bean
* @param string $user_id
* @param string $where
*
* @return array
*/
function build_related_list_by_user_id($bean, $user_id, $where)
{
$bean_id_name = strtolower($bean->object_name) . '_id';
$select = "SELECT {$bean->table_name}.* from {$bean->rel_users_table},{$bean->table_name} ";
$auto_where = ' WHERE ';
if (!empty($where)) {
$auto_where .= $where . ' AND ';
}
$auto_where .= " {$bean->rel_users_table}.{$bean_id_name}={$bean->table_name}.id AND {$bean->rel_users_table}.user_id='{$user_id}' AND {$bean->table_name}.deleted=0 AND {$bean->rel_users_table}.deleted=0";
$query = $select . $auto_where;
$result = $bean->db->query($query, true);
$list = [];
while ($row = $bean->db->fetchByAssoc($result)) {
$row = $bean->convertRow($row);
$bean->fetched_row = $row;
$bean->fromArray($row);
$bean->processed_dates_times = [];
$bean->check_date_relationships_load();
$bean->fill_in_additional_detail_fields();
/**
* PHP 5+ always treats objects as passed by reference
* Need to clone it if we're using 5.0+
* clone() not supported by 4.x
*/
if (version_compare(phpversion(), "5.0", ">=")) {
$newBean = clone $bean;
} else {
$newBean = $bean;
}
$list[] = $newBean;
}
return $list;
}
示例2: convertRow
/**
* (non-PHPdoc)
* @see SugarBean::convertRow()
*/
public function convertRow($row)
{
$row = parent::convertRow($row);
if (!empty($row['relationship_role_columns'])) {
$row['relationship_role_columns'] = json_decode($row['relationship_role_columns']);
}
return $row;
}