ElementTagsProposition.php 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. namespace Muzich\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Muzich\CoreBundle\Validator as MuzichAssert;
  7. /**
  8. * Cette table permet aux utilisateurs de proposer des tags sur des éléments
  9. * ne leurs appartenant pas.
  10. *
  11. * @ORM\Entity
  12. * @ORM\Table(name="element_tags_proposition")
  13. * @ORM\Entity(repositoryClass="Muzich\CoreBundle\Repository\ElementTagsPropositionRepository")
  14. *
  15. */
  16. class ElementTagsProposition
  17. {
  18. /**
  19. * @ORM\Id
  20. * @ORM\Column(type="integer")
  21. * @ORM\GeneratedValue(strategy="AUTO")
  22. * @var type int
  23. */
  24. protected $id;
  25. /**
  26. * Propriétaire de la proposition
  27. *
  28. * @ORM\ManyToOne(targetEntity="User", inversedBy="element_tags_propositions")
  29. * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  30. */
  31. protected $user;
  32. /**
  33. * Propriétaire de la proposition
  34. *
  35. * @ORM\ManyToOne(targetEntity="Element", inversedBy="tags_propositions")
  36. * @ORM\JoinColumn(name="element_id", referencedColumnName="id")
  37. */
  38. protected $element;
  39. /**
  40. * Cet attribut stocke la liste des tags liés a cette proposition.
  41. *
  42. * @ORM\ManyToMany(targetEntity="Tag", inversedBy="propositions")
  43. * @ORM\JoinTable(name="element_tags_proposition_tags_rel")
  44. * @MuzichAssert\Tags()
  45. */
  46. protected $tags;
  47. /**
  48. * @var datetime $created
  49. *
  50. * @ORM\Column(type="datetime")
  51. */
  52. private $created;
  53. // /**
  54. // * @var datetime $created
  55. // *
  56. // * @Gedmo\Timestampable(on="create")
  57. // * @ORM\Column(type="datetime")
  58. // */
  59. // private $created;
  60. //
  61. // /**
  62. // * @var datetime $updated
  63. // *
  64. // * @ORM\Column(type="datetime")
  65. // * @Gedmo\Timestampable(on="update")
  66. // */
  67. // private $updated;
  68. /**
  69. * Get id
  70. *
  71. * @return integer
  72. */
  73. public function getId()
  74. {
  75. return $this->id;
  76. }
  77. /**
  78. * Set created
  79. *
  80. * @param datetime $created
  81. */
  82. public function setCreated($created)
  83. {
  84. $this->created = $created;
  85. }
  86. /**
  87. * Get created
  88. *
  89. * @return datetime
  90. */
  91. public function getCreated()
  92. {
  93. return $this->created;
  94. }
  95. // /**
  96. // * Set updated
  97. // *
  98. // * @param datetime $updated
  99. // */
  100. // public function setUpdated($updated)
  101. // {
  102. // $this->updated = $updated;
  103. // }
  104. //
  105. // /**
  106. // * Get updated
  107. // *
  108. // * @return datetime
  109. // */
  110. // public function getUpdated()
  111. // {
  112. // return $this->updated;
  113. // }
  114. /**
  115. * Set user
  116. *
  117. * @param Muzich\CoreBundle\Entity\User $user
  118. */
  119. public function setUser(\Muzich\CoreBundle\Entity\User $user)
  120. {
  121. $this->user = $user;
  122. }
  123. /**
  124. * Get user
  125. *
  126. * @return Muzich\CoreBundle\Entity\User
  127. */
  128. public function getUser()
  129. {
  130. return $this->user;
  131. }
  132. /**
  133. * Set element
  134. *
  135. * @param Muzich\CoreBundle\Entity\Element $element
  136. */
  137. public function setElement(\Muzich\CoreBundle\Entity\Element $element)
  138. {
  139. $this->element = $element;
  140. }
  141. /**
  142. * Get element
  143. *
  144. * @return Muzich\CoreBundle\Entity\Element
  145. */
  146. public function getElement()
  147. {
  148. return $this->element;
  149. }
  150. /**
  151. * Add tags
  152. *
  153. * @param Muzich\CoreBundle\Entity\Tag $tags
  154. */
  155. public function addTag(\Muzich\CoreBundle\Entity\Tag $tags)
  156. {
  157. $this->tags[] = $tags;
  158. }
  159. /**
  160. * Get tags
  161. *
  162. * @return Doctrine\Common\Collections\Collection
  163. */
  164. public function getTags()
  165. {
  166. return $this->tags;
  167. }
  168. }