public function getSearchCondition(Query $query, $table, $value, $searchmode, $fieldname = '') { // If we are accidentally mistaken for a relation and passed an array // we only take our own attribute value from the array if ($this->m_searchmode) { $searchmode = $this->m_searchmode; } $expression = '(' . str_replace('[table]', $table, $this->m_expression) . ')'; if ($this->getSearchType() == 'date') { $attr = new DateAttribute($this->fieldName()); return $attr->getSearchCondition($query, $table, $value, $searchmode, $expression); } if ($this->getSearchType() == 'number') { $attr = new NumberAttribute($this->fieldName()); $value = $attr->processSearchValue($value, $searchmode); if ($searchmode == 'between') { return $attr->getBetweenCondition($query, $expression, $value); } if (isset($value['from']) && $value['from'] != '') { $value = $value['from']; } else { if (isset($value['to']) && $value['to'] != '') { $value = $value['to']; } else { return ''; } } } $func = $searchmode . 'Condition'; if (method_exists($query, $func) && $value !== '' && $value !== null) { return $query->{$func}($expression, $this->escapeSQL($value)); } return ''; }