Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 setContent($value)
  32. {
  33. $this->content = $value;
  34. }
  35. public function setID($value)
  36. {
  37. $this->id = $value;
  38. }
  39. public function setSlug($value)
  40. {
  41. $this->slug = $value;
  42. }
  43. public function setTitle($value)
  44. {
  45. $this->title = $value;
  46. }
  47. public function getContent()
  48. {
  49. return $this->content;
  50. }
  51. public function getID()
  52. {
  53. return $this->id;
  54. }
  55. public function getSlug()
  56. {
  57. return $this->slug;
  58. }
  59. public function getTitle()
  60. {
  61. return $this->title;
  62. }
  63. public function getComments()
  64. {
  65. $comments = new Comment();
  66. $this->comments = $comments->getComments($this->id);
  67. return $this->comments;
  68. }
  69. public function save()
  70. {
  71. $db = new BlogDB();
  72. $data = ["slug" => $this->slug, "title" => $this->title, "content" => $this->content];
  73. //$db->createBlog($data);
  74. $db->createBlog($this);
  75. }
  76. }