View file upload/src/addons/XenCentral/Feedback/Repository/Comment.php

File size: 1.36Kb
<?php
/**
 * @package XenCentral Feedback System
 * @author DNF Technology
 * @copyright Drnoyan & Nalyan LDA, Portugal, EU
 * @license http://dnf.technology/terms/
 * @link http://customers.dnf.technology
 * @version 2.0.0 Beta 10
 * @revision 12
 */

namespace XenCentral\Feedback\Repository;

use XF\Mvc\Entity\Finder;
use XF\Mvc\Entity\Repository;

class Comment extends Repository
{
    use FeedbackAbstractRepository;


    public function getCommentById($comment_id)
    {
        return $this->db()->fetchRow('
			SELECT comment.*
			FROM xf_xc_feedback_comment AS comment
			WHERE comment.comment_id = ?
		', $comment_id);
    }

    public function getAllComments($fb_id)
    {
        $comments=$this->db()->fetchAll("
			SELECT comment.*, commenteduser.username FROM xf_xc_feedback_comment AS comment
			LEFT JOIN xf_user AS commenteduser ON commenteduser.user_id=comment.user_id
			WHERE comment.fb_id=? 
			ORDER BY comment.dateline ASC
		", array($fb_id));



        return $comments;
    }

    public function getFirstComment($fb_id)
    {
        $comment=$this->db()->fetchOne("
			SELECT comment.*, commenteduser.username FROM xf_xc_feedback_comment AS comment
			LEFT JOIN xf_user AS commenteduser ON commenteduser.user_id=comment.user_id
			WHERE comment.fb_id=? 
			ORDER BY comment.dateline ASC
			LIMIT 0, 1
		", array($fb_id));


        return $comment;
    }

}