++ed by:
MBAAS PRAIRIE ROMANF POTATOGIM TIMB

11 PAUSE users
16 non-PAUSE users.

Author image Henry Van Styn
and 14 contributors

resolve_dbic_colname

Arguments: $fieldName, \%merge_join, $get_render_col (bool)
Return Value: Valid DBIC 'select'

Returns a value which can be added to DBIC's ->{attr}{select} in order to select the column.

$fieldName is the ExtJS column name to resolve. This contains the full path to the column which may span multiple joins, for example:

  rel1__rel2__foo

In this case, 'rel1' is a relationship of the local (top-level) source, and rel2 is a relationship of the 'rel1' source. The \%merge_join argument is passed by reference and modified to contain the join needed for the select. In the case, assuming 'foo' is an ordinary column of the 'rel2' source, the select/as/join might be the following:

  select  : 'rel2.foo'
  as      : 'rel1__rel2__foo'   # already implied by the $fieldName
  join    : { rel1 => 'rel2' }  # merged into %merge_join

However, 'foo' might not be a column in the relationship of the 'rel2' source - it might be a relationship or a virtual column. In these cases, a sub-select/query is generated for the select, which is dependent on what foo actually is. For multi-rels it is a count of the related rows while for single rels it is a select of the remote display_column. For virtual columns, it is a sub-select of whatever the 'sql' attr is set to for the given virtual_column config.