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

getComment() public static method

Get all data for a given id
public static getComment ( integer $id ) : array
$id integer The Id of the comment to fetch?
return array
    public static function getComment($id)
    {
        return (array) BackendModel::getContainer()->get('database')->getRecord('SELECT i.*, UNIX_TIMESTAMP(i.created_on) AS created_on,
             p.id AS post_id, p.title AS post_title, m.url AS post_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.id = ? AND p.status = ?
             LIMIT 1', array((int) $id, 'active'));
    }

Usage Example

Beispiel #1
0
 /**
  * Get the data
  * If a revision-id was specified in the URL we load the revision and not the actual data.
  */
 private function getData()
 {
     // get the record
     $this->record = (array) BackendBlogModel::getComment($this->id);
     // no item found, throw an exceptions, because somebody is f*****g with our URL
     if (empty($this->record)) {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
All Usage Examples Of Backend\Modules\Blog\Engine\Model::getComment