[Solar-talk] fetchWhere() spice
Rodrigo Moraes
rodrigo.moraes at gmail.com
Mon Jan 8 09:29:07 PST 2007
Recently in SVN Solar_Sql_Table::fetchWhere() became deprecated in
favor of a better method name, fetchRow(). I thought that instead of
marking it as deprecated it would be nice to add some spice to
fetchWhere(), and make it act like fetchAll() or fetchRow() depending
on the passed parameters. This would be 100% backwards compatible with
existing fetchWhere() calls and can be used as a shorthand for models
dealing with both kinds of results depending on the circumstances.
This is the current SVN:
public function fetchWhere($where = null, $order = null)
{
return $this->select('row', $where, $order);
}
This is the spiced fetchWhere(), which as you can see doesn't change
the current results at all:
public function fetchWhere($where = null, $order = null, $page =
null, $type = 'row')
{
return $this->select($type, $where, $order, $page);
}
Then, fetchWhere() would be an alternative for those that are building
fetchAll() or fetchRow() under conditionals. It's simple and useful.
Bad idea?
rodrigo
More information about the solar-talk
mailing list