private function loadSearchConditionals() { foreach ($this->table_headers as $field) { // If search column is set, then we only match on that column. if (!empty($this->search_column) && $this->search_column != $field->getName()) { continue; } if (!isset($conditional)) { $conditional = $this->db->createConditional($field, '%' . $this->search_phrase . '%', 'like'); } else { $conditional = $this->db->createConditional($conditional, $this->db->createConditional($field, '%' . $this->search_phrase . '%', 'like'), 'OR'); } } $this->db->addConditional($conditional); }
/** * Calls getFieldCondtional and uses it within a DB::addConditional call. Note * that addConditional ONLY USES "AND" COMPARISONS. This is just a shortcut. * More intricate conditionals should not use this method. * * @see \Database\Table::getFieldConditional * @param string $field_name * @param string $value * @param string $operator */ public function addFieldConditional($field_name, $value, $operator = null) { $this->db->addConditional($this->getFieldConditional($field_name, $value, $operator)); }