在SugarCRM的View Page中检索引用的表数据

I'm new to PHP and SugarCRM, I wrote own DetailView.php & DetailView.html under my module to make a completely new layout. Already know current bean can be get by below approach

$focus = new PYR_Player();
$detailView = new DetailView();
$offset=0;
$result = $detailView->processSugarBean("PYR_Player", $focus, $offset);

But how to get list data from the referenced table? I tried processUnionBeans but don't know how to get subpanel_definitions. Any ideas?

$query=$detailView->processUnionBeans($focus, $subpanel_definitions, "pyr_player_pyr_balance_CELL");

SugarCRM version is Pro 6.5.8

To custom the query for referenced list in "subpanel", can simply change the "get_subpanel_data" attribute in layoutdefs.ext.php, to specify the custom query

    $layout_defs['Accounts'] = array(
    'subpanel_setup' => array(
        'xxxs' => array(
            'order' => 30,
            'module' => 'xxx',
            'sort_order' => 'desc',
            'sort_by' => 'start_date',
            'subpanel_name' => 'XXXForAccounts',
            'get_subpanel_data' => 'function:get_xxxs_list_query',  // customed query sql.
            'add_subpanel_data' => 'id',
            'title_key' => 'LBL_XXX_SUBPANEL_TITLE',
            'default_hidden' => true,
        ),
    ),
);

Then Add the function in Account.php

function get_xxxs_list_query(){ ... return sql;}