RelatedArticle.php 1.2 KB

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