Backend\Modules\Blog\Engine\Model::getAllCommentsForStatus PHP Method

getAllCommentsForStatus() public static method

Get the comments
public static getAllCommentsForStatus ( string $status, integer $limit = 30, integer $offset ) : array
$status string The type of comments to get.
$limit integer The maximum number of items to retrieve.
$offset integer The offset.
return array
    public static function getAllCommentsForStatus($status, $limit = 30, $offset = 0)
    {
        if ($status !== null) {
            $status = (string) $status;
        }
        $limit = (int) $limit;
        $offset = (int) $offset;
        // no status passed
        if ($status === null) {
            return (array) BackendModel::getContainer()->get('database')->getRecords('SELECT i.id, UNIX_TIMESTAMP(i.created_on) AS created_on, i.author, i.email, i.website, i.text, i.type, i.status,
                 p.id AS post_id, p.title AS post_title, m.url AS post_url, p.language AS post_language
                 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.language = ?
                 GROUP BY i.id
                 LIMIT ?, ?', array(BL::getWorkingLanguage(), $offset, $limit));
        }
        return (array) BackendModel::getContainer()->get('database')->getRecords('SELECT i.id, UNIX_TIMESTAMP(i.created_on) AS created_on, i.author, i.email, i.website, i.text, i.type, i.status,
             p.id AS post_id, p.title AS post_title, m.url AS post_url, p.language AS post_language
             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 i.language = ?
             GROUP BY i.id
             LIMIT ?, ?', array($status, BL::getWorkingLanguage(), $offset, $limit));
    }