A little late for the party, but for the sake of thoroughness, I thought that I would provide an alternative that would work well for me, and one that might be a little easier to implement for some developers:
// '$gateway' is a Zend\Db\TableGateway\TableGateway object... $search_string = 'something'; $select = $gateway->select(function($select) use($search_string) { $select->where->OR->like('first_name', '%'. $search_string .'%'); $select->where->OR->like('last_name', '%'. $search_string .'%'); });
Once launched, $select will hold your result set, ready to go through.
Hope this helps someone! :)
source share