system/classes/Model.php
protected function _getCustomValue($attributeName, $query, $loadMap = false)
    {
      $def = $this->model_attributes[$attributeName];
      $result = $this->_getRelation($attributeName, $query, $loadMap); //$this->_getAttributeData($attributeName, $query, $loadMap);

      if (!$result) {
        $result = $query->fetch();
      }
      
      return $result;
    }
protected function _getCustomValue($attributeName, $query, $loadMap = false)
    {
      $def = $this->model_attributes[$attributeName];
      $result = $this->_getRelation($attributeName, $query, $loadMap); //$this->_getAttributeData($attributeName, $query, $loadMap);

      if (!$result) {
        $result = $query->fetch();
      }
      
      return $result;
    }
Requires a query object and will fetch related models with any parameters defined
on that query. If the attribute being fetched is not a model relationship, then it will
just execute the query and return the result.

@return mixed