12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?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();
- $data = ["slug" => $this->slug, "title" => $this->title, "content" => $this->content];
- //$db->createBlog($data);
- $db->createBlog($this);
- }
-
- public function getAssociative()
- {
- }
- }
|