/** * Create a from statement * * @param SugarBean|array $bean * @return string */ protected function compileFrom($bean) { $alias = ""; $return = array(); if (is_array($bean)) { list($bean, $alias) = $bean; $this->from_alias = $alias; } $this->from_bean = $bean; $table = $bean->getTableName(); $table_cstm = ''; $from_clause = "{$table}"; if (!empty($alias)) { $from_clause .= " {$alias}"; } //SugarQuery will determine if we actually need to add the table or not. $this->sugar_query->joinCustomTable($bean, $alias); if (!empty($this->from_alias)) { $this->primary_table = $this->from_alias; $this->primary_custom_table = $this->from_alias . '_c'; } else { $this->primary_table = $this->from_bean->getTableName(); $this->primary_custom_table = $this->from_bean->get_custom_table_name(); } $return = $from_clause; return $return; }