Object of class could not be converted to string

TheBigK

Well-known member
One of the functions in my model looks like this:

PHP:
public function getListOfAllAuthors()
{
return $this->_getDb()->fetchAll('
SELECT username AS username FROM xf_thread AS threads
INNER JOIN EWRporta2_catlinks AS catlinks
ON (catlinks.thread_id = threads.thread_id)
WHERE catlinks.category_id = 1
GROUP BY username;
');
}

The query itself runs fine and returns expected output when I run it directly on the database. However, XF says :-

ErrorException: Object of class BloggerReport_Model_Report could not be converted to string - library/BloggerReport/ControllerAdmin/Index.php:15
Generated By: admin, 6 minutes ago
Stack Trace
#0 /Applications/MAMP/htdocs/xf/library/BloggerReport/ControllerAdmin/Index.php(15): XenForo_Application::handlePhpError(4096, 'Object of class...', '/Applications/M...', 15, Array)
#1 /Applications/MAMP/htdocs/xf/library/XenForo/FrontController.php(347): BloggerReport_ControllerAdmin_Index->actionIndex()
#2 /Applications/MAMP/htdocs/xf/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#3 /Applications/MAMP/htdocs/xf/admin.php(13): XenForo_FrontController->run()
#4 {main}
Request State
array
(size=3)
'url' => string 'http://localhost/xf/admin.php?bloggerperformancereport/' (length=55)
'_GET' =>
array (size=1)
'bloggerperformancereport/' => string '' (length=0)
'_POST' =>
array (size=0)
empty

This is what my controller has: -

PHP:
$reportModel = $this->_getBloggerReportModel();
$allAuthors = $this->$reportModel->getListOfAllAuthors();

Been scratching my head over this for long. I tried replacing fetchAll with query('') but it didn't help. What am I doing wrong?
 
Top Bottom