Article.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. namespace Translatable\Fixture;
  3. use Gedmo\Translatable\Translatable;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\Entity
  8. */
  9. class Article implements Translatable
  10. {
  11. /** @ORM\Id @ORM\GeneratedValue @ORM\Column(type="integer") */
  12. private $id;
  13. /**
  14. * @Gedmo\Translatable
  15. * @ORM\Column(name="title", type="string", length=128)
  16. */
  17. private $title;
  18. /**
  19. * @Gedmo\Translatable
  20. * @ORM\Column(name="content", type="text", nullable=true)
  21. */
  22. private $content;
  23. /**
  24. * @Gedmo\Translatable(fallback=false)
  25. * @ORM\Column(name="views", type="integer", nullable=true)
  26. */
  27. private $views;
  28. /**
  29. * @Gedmo\Translatable(fallback=true)
  30. * @ORM\Column(name="author", type="string", nullable=true)
  31. */
  32. private $author;
  33. /**
  34. * Used locale to override Translation listener`s locale
  35. * @Gedmo\Locale
  36. */
  37. private $locale;
  38. /**
  39. * @ORM\OneToMany(targetEntity="Comment", mappedBy="article")
  40. */
  41. private $comments;
  42. public function getId()
  43. {
  44. return $this->id;
  45. }
  46. public function addComment(Comment $comment)
  47. {
  48. $comment->setArticle($this);
  49. $this->comments[] = $comment;
  50. }
  51. public function getComments()
  52. {
  53. return $this->comments;
  54. }
  55. public function setTitle($title)
  56. {
  57. $this->title = $title;
  58. }
  59. public function getTitle()
  60. {
  61. return $this->title;
  62. }
  63. public function setContent($content)
  64. {
  65. $this->content = $content;
  66. }
  67. public function getContent()
  68. {
  69. return $this->content;
  70. }
  71. public function setTranslatableLocale($locale)
  72. {
  73. $this->locale = $locale;
  74. }
  75. public function setViews ($views)
  76. {
  77. $this->views = $views;
  78. }
  79. public function getViews ()
  80. {
  81. return $this->views;
  82. }
  83. public function setAuthor($author)
  84. {
  85. $this->author = $author;
  86. }
  87. public function getAuthor()
  88. {
  89. return $this->author;
  90. }
  91. }