123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?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 setContent($value)
- {
- $this->content = $value;
- }
-
- public function setID($value)
- {
- $this->id = $value;
- }
-
- public function setSlug($value)
- {
- $this->slug = $value;
- }
-
- public function setTitle($value)
- {
- $this->title = $value;
- }
-
- public function getContent()
- {
- return $this->content;
- }
-
- public function getID()
- {
- return $this->id;
- }
- public function getSlug()
- {
- return $this->slug;
- }
- public function getTitle()
- {
- return $this->title;
- }
-
-
- 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);
- }
- }
|