You can use a closure to manipulate the Select object like so:
public function fetchAll()
{
// The Select object will be passed to your Closure
// before the query is executed.
$resultSet = $this->select(function (Select $select) use () {
//$select->columns(array('user_id', 'email', 'name'));
$select->order('name ASC');
});
return $resultSet;
}
An example passing through conditions / Where
public function fetchAll($someCondition)
{
// The Select object will be passed to your Closure
// before the query is executed.
$resultSet = $this->select(function (Select $select) use ($someCondition) {
$select->columns(array('user_id', 'email', 'name'));
$select->order('name ASC');
$select->where(array('user_id'=> $someCondition));
});
return $resultSet;
}