RelatedArticle.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace Loggable\Fixture\Document;
  3. use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. /**
  6. * @ODM\Document
  7. * @Gedmo\Loggable
  8. */
  9. class RelatedArticle
  10. {
  11. /**
  12. * @ODM\Id
  13. */
  14. private $id;
  15. /**
  16. * @Gedmo\Versioned
  17. * @ODM\String
  18. */
  19. private $title;
  20. /**
  21. * @Gedmo\Versioned
  22. * @ODM\String
  23. */
  24. private $content;
  25. /**
  26. * @ODM\ReferenceMany(targetDocument="Comment", mappedBy="article")
  27. */
  28. private $comments;
  29. public function getId()
  30. {
  31. return $this->id;
  32. }
  33. public function addComment(Comment $comment)
  34. {
  35. $comment->setArticle($this);
  36. $this->comments[] = $comment;
  37. }
  38. public function getComments()
  39. {
  40. return $this->comments;
  41. }
  42. public function setTitle($title)
  43. {
  44. $this->title = $title;
  45. }
  46. public function getTitle()
  47. {
  48. return $this->title;
  49. }
  50. public function setContent($content)
  51. {
  52. $this->content = $content;
  53. }
  54. public function getContent()
  55. {
  56. return $this->content;
  57. }
  58. }