public function sourceQuery($params) { if ($this->baseReport->hasMethod('sourceRecords')) { // The default implementation will create a fake query from our sourceRecords() method return parent::sourceQuery($params); } else { if ($this->baseReport->hasMethod('sourceQuery')) { $this->beforeQuery($params); $query = $this->baseReport->sourceQuery($params); $this->afterQuery(); return $query; } else { user_error("Please override sourceQuery()/sourceRecords() and columns() in your base report", E_USER_ERROR); } } }