public static function getLatestComments($status, $limit = 10)
{
// get the comments (order by id, this is faster then on date, the higher the id, the more recent
$comments = (array) BackendModel::getContainer()->get('database')->getRecords('SELECT i.id, i.author, i.text, UNIX_TIMESTAMP(i.created_on) AS created_in,
p.title, p.language, m.url
FROM blog_comments AS i
INNER JOIN blog_posts AS p ON i.post_id = p.id AND i.language = p.language
INNER JOIN meta AS m ON p.meta_id = m.id
WHERE i.status = ? AND p.status = ? AND i.language = ?
ORDER BY i.created_on DESC
LIMIT ?', array((string) $status, 'active', BL::getWorkingLanguage(), (int) $limit));
// overwrite url
$baseUrl = BackendModel::getURLForBlock('Blog', 'detail');
foreach ($comments as &$row) {
$row['full_url'] = $baseUrl . '/' . $row['url'];
}
return $comments;
}