/** * * Fixes the eager params based on the settings for this related. * * @param Solar_Sql_Model_Params_Eager $eager The eager params. * * @return void * */ protected function _fixEagerParams($eager) { // always need an alias if (!$eager['alias']) { $eager->alias($this->foreign_alias); } // always need a merge type if (!$eager['merge']) { $eager->merge($this->merge); } // if a condition is present, and no join type is specified, make it // an inner join. this is to mimic WHERE behavior. if ($eager['conditions'] && !$eager['join_type']) { $eager->joinType('inner'); } // always need a join type if (!$eager['join_type']) { $eager->joinType('left'); } // for inner joins, always join to the main fetch if ($eager['join_type'] == 'inner') { $eager->joinFlag(true); } // which columns? if ($eager['join_only']) { // don't fetch cols when only joining ... $eager['cols'] = false; // ... and force the join $eager->joinFlag(true); } elseif ($eager['cols'] === array() || $eager['cols'] === null) { // empty array or null means "use default cols" $eager->cols($this->cols); } // native-by strategy (wherein or select) if (!$eager['native_by']) { $eager['native_by'] = $this->native_by; } // when to switch from array to select if ($eager['wherein_max'] === null) { $eager['wherein_max'] = $this->wherein_max; } }
/** * * Fixes the eager params based on the settings for this related. * * Adds a column prefix when not already specified. * * If there are sub-eagers, sets the merge strategy to 'client' so that * the sub-eagers are honored. * * On a server merge, sets the join flag. * * @param Solar_Sql_Model_Params_Eager $eager The eager params. * * @return void * */ protected function _fixEagerParams($eager) { if (!$eager['cols_prefix']) { if ($eager['alias']) { $eager->colsPrefix($eager['alias']); } else { $eager->colsPrefix($this->name); } } // if there are sub-eagers, merge this eager client-side; otherwise, // the sub-eagers won't be honored. if ($eager['eager']) { $eager->merge('client'); } parent::_fixEagerParams($eager); if ($eager['merge'] == 'server') { $eager->joinFlag(true); } }