本文整理匯總了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;
}