Element.php 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <?php
  2. namespace Muzich\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use \Doctrine\Common\Collections\ArrayCollection;
  5. /**
  6. * L'Element est l'Element (huhu) central de l'application. C'est cet
  7. * entité qui stocke le media partagé sur le réseau.
  8. *
  9. * @ORM\Entity
  10. * @ORM\Table(name="element")
  11. */
  12. class Element
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\Column(type="integer")
  17. * @ORM\GeneratedValue(strategy="AUTO")
  18. * @var type int
  19. */
  20. protected $id;
  21. /**
  22. * Cet attribut stocke le type d'élément.
  23. *
  24. * @ORM\ManyToOne(targetEntity="ElementType", inversedBy="elements")
  25. * @ORM\JoinColumn(name="element_type_id", referencedColumnName="id")
  26. */
  27. protected $type;
  28. /**
  29. * Cet attribut stocke la liste des tags liés a cet élément.
  30. *
  31. * @ORM\ManyToMany(targetEntity="Tag", inversedBy="elements")
  32. * @ORM\JoinTable(name="elements_tag")
  33. */
  34. private $tags;
  35. /**
  36. * Propriétaire de l'élément
  37. *
  38. * @ORM\ManyToOne(targetEntity="User", inversedBy="elements")
  39. * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  40. */
  41. protected $owner;
  42. /**
  43. * Groupe de l'élément
  44. *
  45. * @ORM\ManyToOne(targetEntity="Group", inversedBy="elements")
  46. * @ORM\JoinColumn(name="group_id", referencedColumnName="id")
  47. */
  48. protected $group = null;
  49. /**
  50. * Cet attribu stocke les enregistrements UsersElementsFavorites liés
  51. * a ce Tag dans le cadre des Elements favoris.
  52. *
  53. * @ORM\OneToMany(targetEntity="UsersElementsFavorites", mappedBy="tag")
  54. */
  55. protected $elements_favorites;
  56. /**
  57. * L'url est l'url du media.
  58. *
  59. * @ORM\Column(type="string", length=1024)
  60. * @var type string
  61. */
  62. protected $url;
  63. /**
  64. * Libellé du media
  65. *
  66. * @ORM\Column(type="string", length=128)
  67. * @var type string
  68. */
  69. protected $name;
  70. /**
  71. * Date d'ajout dans le réseau
  72. *
  73. * @ORM\Column(type="datetime")
  74. * @var type string
  75. */
  76. protected $date_added;
  77. /**
  78. * Get id
  79. *
  80. * @return integer
  81. */
  82. public function getId()
  83. {
  84. return $this->id;
  85. }
  86. /**
  87. * Set url
  88. *
  89. * @param string $url
  90. */
  91. public function setUrl($url)
  92. {
  93. $this->url = $url;
  94. }
  95. /**
  96. * Get url
  97. *
  98. * @return string
  99. */
  100. public function getUrl()
  101. {
  102. return $this->url;
  103. }
  104. /**
  105. * Set name
  106. *
  107. * @param string $name
  108. */
  109. public function setName($name)
  110. {
  111. $this->name = $name;
  112. }
  113. /**
  114. * Get name
  115. *
  116. * @return string
  117. */
  118. public function getName()
  119. {
  120. return $this->name;
  121. }
  122. /**
  123. * Set date_added
  124. *
  125. * @param datetime $dateAdded
  126. */
  127. public function setDateAdded($dateAdded)
  128. {
  129. $this->date_added = $dateAdded;
  130. }
  131. /**
  132. * Get date_added
  133. *
  134. * @return datetime
  135. */
  136. public function getDateAdded()
  137. {
  138. return $this->date_added;
  139. }
  140. /**
  141. * Set type
  142. *
  143. * @param ElementType $type
  144. */
  145. public function setType(ElementType $type)
  146. {
  147. $this->type = $type;
  148. }
  149. /**
  150. * Get type
  151. *
  152. * @return ElementType
  153. */
  154. public function getType()
  155. {
  156. return $this->type;
  157. }
  158. public function __construct()
  159. {
  160. $this->tags = new ArrayCollection();
  161. }
  162. /**
  163. * Add tags
  164. *
  165. * @param Tag $tags
  166. */
  167. public function addTag(Tag $tags)
  168. {
  169. $this->tags[] = $tags;
  170. }
  171. /**
  172. * Get tags
  173. *
  174. * @return Doctrine\Common\Collections\Collection
  175. */
  176. public function getTags()
  177. {
  178. return $this->tags;
  179. }
  180. /**
  181. * Set owner
  182. *
  183. * @param User $owner
  184. */
  185. public function setOwner(User $owner)
  186. {
  187. $this->owner = $owner;
  188. }
  189. /**
  190. * Get owner
  191. *
  192. * @return User
  193. */
  194. public function getOwner()
  195. {
  196. return $this->owner;
  197. }
  198. /**
  199. * Add elements_favorites
  200. *
  201. * @param UsersElementsFavorites $elementsFavorites
  202. */
  203. public function addUsersElementsFavorites(UsersElementsFavorites $elementsFavorites)
  204. {
  205. $this->elements_favorites[] = $elementsFavorites;
  206. }
  207. /**
  208. * Get elements_favorites
  209. *
  210. * @return Doctrine\Common\Collections\Collection
  211. */
  212. public function getElementsFavorites()
  213. {
  214. return $this->elements_favorites;
  215. }
  216. /**
  217. * Set group
  218. *
  219. * @param Group $group
  220. */
  221. public function setGroup(Group $group)
  222. {
  223. $this->group = $group;
  224. }
  225. /**
  226. * Get group
  227. *
  228. * @return Group
  229. */
  230. public function getGroup()
  231. {
  232. return $this->group;
  233. }
  234. }