Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Entities;
  4.  
  5. /**
  6. * @Entity
  7. * @Table(name="user")
  8. */
  9. class User
  10. {
  11. /**
  12. * @Id @Column(type="integer")
  13. * @GeneratedValue
  14. */
  15. private $id;
  16.  
  17. /** @Column(type="text") */
  18. private $name;
  19.  
  20. /**
  21. * @ManyToMany(targetEntity="Comment")
  22. * @JoinTable(name="user_comment",
  23. * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
  24. * inverseJoinColumns={@JoinColumn(name="comment_id", referencedColumnName="id")}
  25. * )
  26. */
  27. private $comments;
  28.  
  29. public function __construct()
  30. {
  31. $this->comments = new \Doctrine\Common\Collections\ArrayCollection;
  32. }
  33.  
  34. public function getId()
  35. {
  36. return $this->id;
  37. }
  38.  
  39. public function setId($value)
  40. {
  41. $this->id = $value;
  42. return $this;
  43. }
  44.  
  45. public function getComments()
  46. {
  47. return $this->comments;
  48. }
  49.  
  50. public function getName()
  51. {
  52. return $this->name;
  53. }
  54.  
  55. public function setName($value)
  56. {
  57. $this->name = $value;
  58. return $this;
  59. }
  60.  
  61. }
  62.  
  63.  
  64.  
  65. <?php
  66.  
  67. namespace Entities;
  68.  
  69. /**
  70. * @Entity
  71. * @Table(name="comment")
  72. */
  73. class Comment
  74. {
  75. /**
  76. * @Id @Column(type="integer")
  77. * @GeneratedValue
  78. */
  79. private $id;
  80.  
  81. /** @Column(type="text") */
  82. private $text;
  83.  
  84. public function getId()
  85. {
  86. return $this->id;
  87. }
  88.  
  89. public function setId($value)
  90. {
  91. $this->id = $value;
  92. return $this;
  93. }
  94.  
  95. public function getText()
  96. {
  97. return $this->text;
  98. }
  99.  
  100. public function setText($value)
  101. {
  102. $this->text = $value;
  103. return $this;
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement