/** * Attempt to fetch conflict-with existing record from database * * @param type $key * @param type $confl * @return type */ private function _get_with($key, $confl) { $mname = TankSource::get_model_for($key); if ($mname && isset($confl['uuid'])) { if ($mname != 'SrcFact') { $rec = AIR2_Record::find($mname, $confl['uuid']); if ($rec) { $data = $rec->toArray(); air2_clean_radix($data); return $data; } } else { // facts suck ... src_id.fact_id ... use raw sql for speed! $ids = explode('.', $confl['uuid']); if ($ids && count($ids) == 2) { $conn = AIR2_DBManager::get_connection(); $s = 'f.fact_id, f.fact_name, f.fact_identifier, f.fact_fv_type, ' . 'afv.fv_value as analyst_fv, sfv.fv_value as source_fv, ' . 'sf.sf_src_value as source_text, sf.sf_lock_flag'; $f = 'src_fact sf join fact f on (sf.sf_fact_id=f.fact_id) left ' . 'join fact_value afv on (sf.sf_fv_id=afv.fv_id) left join ' . 'fact_value sfv on (sf.sf_src_fv_id=sfv.fv_id)'; $w = 'sf_src_id=? and sf_fact_id=?'; $rs = $conn->fetchRow("select {$s} from {$f} where {$w}", array($ids[0], $ids[1])); if ($rs) { return $rs; } } } } return false; }