I'd like to use db_select in a static public function of a certain class. The query should be a base query, which may then be customized in the calling function. Returning the result sets seems to work, but I'd like to return the drupal db_select-object for further usage. Here is some example code:
class foo{
public static function get_query() {
$query = db_select('bar', 'b');
return $query;
}
}
function test() {
$qobj = foo::get_query();
$qobj->fields('b', array('id', 'name'));
$result = $qobj->execute();
...
}
The returned object seems not to be a db_select object, which can be edited further more. Do I have to create a dummy db_select and pass the reference of this object to the static function.
Thank you.
Sven
dpr
orvar_dump
called on a returned object? That way you (and we) would know, not only seem.