|
|
@@ -0,0 +1,46 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace Blog\Model; |
|
|
|
|
|
|
|
use Blog\DB\Blog as BlogDB; |
|
|
|
use Blog\Model\Comment; |
|
|
|
|
|
|
|
class Blog { |
|
|
|
|
|
|
|
protected $author; |
|
|
|
protected $title; |
|
|
|
protected $subtitle; |
|
|
|
protected $date; |
|
|
|
protected $content; |
|
|
|
protected $comments; |
|
|
|
protected $id; |
|
|
|
protected $slug; |
|
|
|
|
|
|
|
public function setAuthor($value) { |
|
|
|
$this->author = $value; |
|
|
|
} |
|
|
|
|
|
|
|
public function setDate($value) { |
|
|
|
$this->date = $value; |
|
|
|
} |
|
|
|
|
|
|
|
public function getDate() { |
|
|
|
return $this->date; |
|
|
|
} |
|
|
|
|
|
|
|
public function getAuthor() { |
|
|
|
return $this->author; |
|
|
|
} |
|
|
|
|
|
|
|
public function getComments() { |
|
|
|
$comments = new Comment(); |
|
|
|
$this->comments = $comments->getComments($this->id); |
|
|
|
return $this->comments; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function save() { |
|
|
|
$db = new BlogDB(); |
|
|
|
$db->createBlog($this); |
|
|
|
} |
|
|
|
} |