Article.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace Translatable\Fixture;
  3. use Gedmo\Translatable\Translatable;
  4. /**
  5. * @Entity
  6. */
  7. class Article implements Translatable
  8. {
  9. /** @Id @GeneratedValue @Column(type="integer") */
  10. private $id;
  11. /**
  12. * @gedmo:Translatable
  13. * @Column(name="title", type="string", length=128)
  14. */
  15. private $title;
  16. /**
  17. * @gedmo:Translatable
  18. * @Column(name="content", type="text")
  19. */
  20. private $content;
  21. /**
  22. * Used locale to override Translation listener`s locale
  23. * @gedmo:Locale
  24. */
  25. private $locale;
  26. /**
  27. * @OneToMany(targetEntity="Comment", mappedBy="article")
  28. */
  29. private $comments;
  30. public function getId()
  31. {
  32. return $this->id;
  33. }
  34. public function addComment(Comment $comment)
  35. {
  36. $comment->setArticle($this);
  37. $this->comments[] = $comment;
  38. }
  39. public function getComments()
  40. {
  41. return $this->comments;
  42. }
  43. public function setTitle($title)
  44. {
  45. $this->title = $title;
  46. }
  47. public function getTitle()
  48. {
  49. return $this->title;
  50. }
  51. public function setContent($content)
  52. {
  53. $this->content = $content;
  54. }
  55. public function getContent()
  56. {
  57. return $this->content;
  58. }
  59. public function setTranslatableLocale($locale)
  60. {
  61. $this->locale = $locale;
  62. }
  63. }