TranslatableArticle.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace Sluggable\Fixture;
  3. use Gedmo\Sluggable\Sluggable,
  4. Gedmo\Translatable\Translatable;
  5. /**
  6. * @Entity
  7. */
  8. class TranslatableArticle implements Sluggable, Translatable
  9. {
  10. /**
  11. * @Id
  12. * @GeneratedValue
  13. * @Column(type="integer")
  14. */
  15. private $id;
  16. /**
  17. * @gedmo:Translatable
  18. * @gedmo:Sluggable
  19. * @Column(type="string", length=64)
  20. */
  21. private $title;
  22. /**
  23. * @gedmo:Translatable
  24. * @gedmo:Sluggable
  25. * @Column(type="string", length=16)
  26. */
  27. private $code;
  28. /**
  29. * @gedmo:Translatable
  30. * @gedmo:Slug
  31. * @Column(type="string", length=128)
  32. */
  33. private $slug;
  34. /**
  35. * @OneToMany(targetEntity="Comment", mappedBy="article")
  36. */
  37. private $comments;
  38. /**
  39. * @ManyToOne(targetEntity="Page", inversedBy="articles")
  40. */
  41. private $page;
  42. /**
  43. * @gedmo:Locale
  44. * Used locale to override Translation listener`s locale
  45. */
  46. private $locale;
  47. public function addComment(Comment $comment)
  48. {
  49. $comment->setArticle($this);
  50. $this->comments[] = $comment;
  51. }
  52. public function getComments()
  53. {
  54. return $this->comments;
  55. }
  56. public function setPage($page)
  57. {
  58. $this->page = $page;
  59. }
  60. public function getId()
  61. {
  62. return $this->id;
  63. }
  64. public function setTitle($title)
  65. {
  66. $this->title = $title;
  67. }
  68. public function getTitle()
  69. {
  70. return $this->title;
  71. }
  72. public function setCode($code)
  73. {
  74. $this->code = $code;
  75. }
  76. public function getCode()
  77. {
  78. return $this->code;
  79. }
  80. public function getSlug()
  81. {
  82. return $this->slug;
  83. }
  84. public function setTranslatableLocale($locale)
  85. {
  86. $this->locale = $locale;
  87. }
  88. }