MS-Tropical/app/models/ArticleComment.php

30 lines
632 B
PHP
Raw Permalink Normal View History

<?php
class ArticleComment
{
private $ID;
private $Author;
private $Content;
private $PostDate;
private $ArticleID;
public function __construct($id)
{
$this->ID = $id;
$result = Database::select('articlecomments', '*', 'WHERE id = :id', data: [':id' => $id]);
$ArticleInfo = $result->fetch();
$this->Author = $ArticleInfo['commentAuthor'];
$this->Content = $ArticleInfo['commentContent'];
$this->PostDate = betterDate($ArticleInfo['commentDate']);
$this->ArticleID = $ArticleInfo['articleID'];
}
public function __get($what)
{
return property_exists($this, $what) ? $this->{$what} : null;
}
}