You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace Blog\Model;
  3. use Blog\DB\Blog as BlogDB;
  4. use Blog\Model\Comment;
  5. class Blog
  6. {
  7. protected $author;
  8. protected $title;
  9. protected $subtitle;
  10. protected $date;
  11. protected $content;
  12. protected $comments;
  13. protected $id;
  14. protected $slug;
  15. public function setAuthor($value)
  16. {
  17. $this->author = $value;
  18. }
  19. public function setDate($value)
  20. {
  21. $this->date = $value;
  22. }
  23. public function getDate()
  24. {
  25. return $this->date;
  26. }
  27. public function getAuthor()
  28. {
  29. return $this->author;
  30. }
  31. public function getComments()
  32. {
  33. $comments = new Comment();
  34. $this->comments = $comments->getComments($this->id);
  35. return $this->comments;
  36. }
  37. public function save()
  38. {
  39. $db = new BlogDB();
  40. $data = ["slug" => $this->slug, "title" => $this->title, "content" => $this->content];
  41. //$db->createBlog($data);
  42. $db->createBlog($this);
  43. }
  44. public function getAssociative()
  45. {
  46. }
  47. }