I am trying to figure out how to make a Mysql Select with an OR in where Clause. By default all clauses in where statement are ANDed and after some hours of try and fail and looking the net can't make it work. In ZF1 it would be an orWhere() but there is not in ZF2.
This is the code i have inside a AbstracttableGateway
:
$resultSet = $this->select(function (Select $select) use ($searchstring) {
$select->join('users','blog_posts.id_user = users.id',array('name'))
->join('blog_categories','blog_posts.id_category = blog_categories.id', array(
'cat_name' => 'name',
'cat_alias' => 'alias',
'cat_image' => 'icon'))
->order('date DESC');
//->where("title LIKE '%" .$searchstring . "%' OR content LIKE '%". $searchstring ."%'")
$select->where->like('content','%'.$searchstring.'%');
$select->where->like('title','%'.$searchstring.'%');
}
);
return $resultSet;
the lines with the $select->where->like
are the ones that are ANDed and I want them with OR. What should I change?