}
foreach ($this->_columns as $tableName => $table) {
- // set alias
- if (!isset($table['alias'])) {
- $this->_columns[$tableName]['alias'] = substr($tableName, 8) .
- '_civireport';
- }
- else {
- $this->_columns[$tableName]['alias'] = $table['alias'] . '_civireport';
- }
-
- $this->_aliases[$tableName] = $this->_columns[$tableName]['alias'];
+ $this->setTableAlias($table, $tableName);
$expFields = array();
// higher preference to bao object
return $select;
}
+ /**
+ * Set table alias.
+ *
+ * @param array $table
+ * @param string $tableName
+ *
+ * @return string
+ * Alias for table.
+ */
+ protected function setTableAlias($table, $tableName) {
+ if (!isset($table['alias'])) {
+ $this->_columns[$tableName]['alias'] = substr($tableName, 8) .
+ '_civireport';
+ }
+ else {
+ $this->_columns[$tableName]['alias'] = $table['alias'] . '_civireport';
+ }
+
+ $this->_aliases[$tableName] = $this->_columns[$tableName]['alias'];
+ return $this->_aliases[$tableName];
+ }
+
}