/** * Determine the column that we should write to * * @param string * @return string */ public function determineColumn($column) { if (empty($this->columnList)) { $this->loadColumns(); } // if the column is exactly the same just return it if (isset($this->columnList[$column])) { return $column; } // check to see if the injected mapper function can solve our column lookup problem if (is_callable($this->mapper)) { $mapped = call_user_func_array($this->mapper, array($column)); if ($mapped) { return $mapped; } } // tabelize the column and see if we have a match and if so return the tabelized version $tablized = Introspection::tabelizeName($column); if (isset($this->columnList[$tablized])) { return $tablized; } // check to see if the column has a specific abbreviation in which case we uppercase the entire word ex SSN, DOB, CC $upperColumn = strtoupper($column); if (isset($this->columnList[$upperColumn])) { return $upperColumn; } // if we have a map array look it up there if (isset($this->mapArray[$column])) { return $this->mapArray[$column]; } }
/** * Turn the search criteria on a model to the respective db search columns * * @param array * @return array */ protected function tablizeCriteria($criteria) { return $criteria; // deprecating this to see what breaks // remap the criteria to the correct DB format $mappedCriteria = array(); if (!empty($criteria) || count($criteria) > 0) { foreach ($criteria as $key => $value) { $colName = Introspection::tabelizeName($key); $mappedCriteria[$colName] = $value; } } return $mappedCriteria; }