Group.php 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <?php
  2. namespace Muzich\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use \Doctrine\Common\Collections\ArrayCollection;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. /**
  7. * Le groupe est une sorte de liste de diffusion, a laquelle les
  8. * users peuvent s'abonner (follow). Un groupe peut tout aussi bien
  9. * être "Les fans de la tek du sud est" qu'un sound système,
  10. * un artiste ...
  11. *
  12. * @ORM\Entity
  13. * @ORM\Table(name="m_group")
  14. */
  15. class Group
  16. {
  17. /**
  18. * @ORM\Id
  19. * @ORM\Column(type="integer")
  20. * @ORM\GeneratedValue(strategy="AUTO")
  21. * @var type int
  22. */
  23. protected $id;
  24. /**
  25. * Nom du groupe
  26. *
  27. * @ORM\Column(type="string", length=128)
  28. * @var type string
  29. */
  30. protected $name;
  31. /**
  32. * @Gedmo\Slug(fields={"name"})
  33. * @ORM\Column(length=128, unique=true)
  34. */
  35. protected $slug;
  36. /**
  37. * Description
  38. *
  39. * @ORM\Column(type="text")
  40. * @var type string
  41. */
  42. protected $description;
  43. /**
  44. * Si open est a vrai, cela traduit que les followers peuvent
  45. * diffuser leur element en tant qu'élément de ce groupe.
  46. *
  47. * @ORM\Column(type="boolean")
  48. * @var type string
  49. */
  50. protected $open = false;
  51. /**
  52. * Cet attribut contient les enregistrements FollowGroup lié
  53. * a ce Groupe dans le cadre des groupes suivis.
  54. *
  55. * @ORM\OneToMany(targetEntity="FollowGroup", mappedBy="group")
  56. */
  57. protected $followers;
  58. /**
  59. * Propriétaire
  60. *
  61. * @ORM\ManyToOne(targetEntity="User")
  62. * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  63. */
  64. protected $owner;
  65. /**
  66. * Cet attribut contient les enregistrements GroupsTagsFavorites lié
  67. * a ce Groupe dans le cadre des tags de groupe.
  68. *
  69. * @ORM\OneToMany(targetEntity="GroupsTagsFavorites", mappedBy="group")
  70. */
  71. protected $tags;
  72. /**
  73. * Cet attribut contient les enregistrements Element lié
  74. * a ce Groupe.
  75. *
  76. * @ORM\OneToMany(targetEntity="Element", mappedBy="group")
  77. */
  78. protected $elements;
  79. /**
  80. *
  81. */
  82. public function __construct()
  83. {
  84. $this->followers = new ArrayCollection();
  85. }
  86. /**
  87. * Get id
  88. *
  89. * @return integer
  90. */
  91. public function getId()
  92. {
  93. return $this->id;
  94. }
  95. /**
  96. * Set name
  97. *
  98. * @param string $name
  99. */
  100. public function setName($name)
  101. {
  102. $this->name = $name;
  103. }
  104. /**
  105. * Get name
  106. *
  107. * @return string
  108. */
  109. public function getName()
  110. {
  111. return $this->name;
  112. }
  113. /**
  114. * Set description
  115. *
  116. * @param string $description
  117. */
  118. public function setDescription($description)
  119. {
  120. $this->description = $description;
  121. }
  122. /**
  123. * Get description
  124. *
  125. * @return string
  126. */
  127. public function getDescription()
  128. {
  129. return $this->description;
  130. }
  131. /**
  132. * Set open
  133. *
  134. * @param boolean $open
  135. */
  136. public function setOpen($open)
  137. {
  138. $this->open = $open;
  139. }
  140. /**
  141. * Get open
  142. *
  143. * @return boolean
  144. */
  145. public function getOpen()
  146. {
  147. return $this->open;
  148. }
  149. /**
  150. * Add followers
  151. *
  152. * @param FollowGroup $followers
  153. */
  154. public function addFollowGroup(FollowGroup $followers)
  155. {
  156. $this->followers[] = $followers;
  157. }
  158. /**
  159. * Get followers
  160. *
  161. * @return Doctrine\Common\Collections\Collection
  162. */
  163. public function getFollowers()
  164. {
  165. return $this->followers;
  166. }
  167. /**
  168. * Set owner
  169. *
  170. * @param User $owner
  171. */
  172. public function setOwner(User $owner)
  173. {
  174. $this->owner = $owner;
  175. }
  176. /**
  177. * Get owner
  178. *
  179. * @return User
  180. */
  181. public function getOwner()
  182. {
  183. return $this->owner;
  184. }
  185. /**
  186. * Add tags
  187. *
  188. * @param GroupsTagsFavorites $tags
  189. */
  190. public function addGroupsTagsFavorites(GroupsTagsFavorites $tags)
  191. {
  192. $this->tags[] = $tags;
  193. }
  194. /**
  195. * Get tags
  196. *
  197. * @return Doctrine\Common\Collections\Collection
  198. */
  199. public function getTags()
  200. {
  201. return $this->tags;
  202. }
  203. /**
  204. * Add elements
  205. *
  206. * @param Element $elements
  207. */
  208. public function addElement(Element $elements)
  209. {
  210. $this->elements[] = $elements;
  211. }
  212. /**
  213. * Get elements
  214. *
  215. * @return Doctrine\Common\Collections\Collection
  216. */
  217. public function getElements()
  218. {
  219. return $this->elements;
  220. }
  221. }