Article.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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
  25. * @Gedmo\NoFallback
  26. * @ORM\Column(name="views", type="integer", nullable=true)
  27. */
  28. private $views;
  29. /**
  30. * Used locale to override Translation listener`s locale
  31. * @Gedmo\Locale
  32. */
  33. private $locale;
  34. /**
  35. * @ORM\OneToMany(targetEntity="Comment", mappedBy="article")
  36. */
  37. private $comments;
  38. public function getId()
  39. {
  40. return $this->id;
  41. }
  42. public function addComment(Comment $comment)
  43. {
  44. $comment->setArticle($this);
  45. $this->comments[] = $comment;
  46. }
  47. public function getComments()
  48. {
  49. return $this->comments;
  50. }
  51. public function setTitle($title)
  52. {
  53. $this->title = $title;
  54. }
  55. public function getTitle()
  56. {
  57. return $this->title;
  58. }
  59. public function setContent($content)
  60. {
  61. $this->content = $content;
  62. }
  63. public function getContent()
  64. {
  65. return $this->content;
  66. }
  67. public function setTranslatableLocale($locale)
  68. {
  69. $this->locale = $locale;
  70. }
  71. public function setViews ($views)
  72. {
  73. $this->views = $views;
  74. }
  75. public function getViews ()
  76. {
  77. return $this->views;
  78. }
  79. }