How to specify multiple conditions and the type of condition using Zend_Db_Table
- by Mario
I have a function in my model that I need to use multiple conditions when querying. Additionally I would like to also have partial matches.
I currently have:
public function searchClient($search_term)
{
$rows = $this->fetchAll(
$this->select()
->where('first_name = ?', $search_term)
);
return $rows->toArray();
}
Which is the equivalent of "SELECT * FROM clients WHERE first_name = 'foobar';"
I would like to have a function that is the equivalent of "SELECT * FROM clients WHERE first_name LIKE '%foobar%' OR last_name LIKE '%foobar%' OR home_phone LIKE '%foobar%';"
How would I create such a query within Zend_Db_Table?