/** * Creates the string of SQL for the select part of a select query, everything behind SELECT and before FROM. * Eg, "Event.post_id, Event.post_name,Event_Detail.EVT_ID..." * @param EE_Model_Query_Info_Carrier $model_query_info * @return string */ private function _construct_default_select_sql(EE_Model_Query_Info_Carrier $model_query_info) { $selects = $this->_get_columns_to_select_for_this_model(); foreach ($model_query_info->get_model_names_included() as $model_relation_chain => $name_of_other_model_included) { $other_model_included = $this->get_related_model_obj($name_of_other_model_included); $selects = array_merge($selects, $other_model_included->_get_columns_to_select_for_this_model($model_relation_chain)); } return implode(", ", $selects); }
/** * Merges info from the other EEM_Related_Model_Info_Carrier into this one. * @param EE_Model_Query_Info_Carrier $other_model_query_info_carrier */ public function merge($other_model_query_info_carrier) { if ($other_model_query_info_carrier && !$this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) { $model_included_on_other_join_sql_and_data_types_carrier = $other_model_query_info_carrier->get_model_names_included(); $this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier); $this->_join_sql .= $other_model_query_info_carrier->_join_sql; } //otherwise don't merge our data. //yes, this means that we must immediately merge any model data into our grand list //as soon as we get some from ONE model, or else we could reject a EEM_Related_Model_Info_Carrier //which is carrying info from two models WHERE one is already included but the other is NOT }