protected function addCompare(CDbCriteria $criteria, $attribute, $value, $sensitive = false, $operator = 'AND', $exactmatch = false)
{
if (method_exists($this->model, 'get_' . $attribute)) {
//It's a magic method attribute, doesn't exist in the db has to be dealt with elsewhere
return;
}
$search = $attribute;
$search = $this->relationalAttribute($criteria, $attribute, $search);
if ($value !== '') {
if (!$sensitive && !$exactmatch) {
$criteria->compare('LOWER(' . $search . ')', strtolower($value), true, $operator);
} elseif ($exactmatch) {
$criteria->compare($search, $value, false, $operator);
} else {
$criteria->compare($search, $value, true, $operator);
}
$this->searchTerms[$attribute] = $value;
}
}