User.php 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php
  2. namespace Muzich\CoreBundle\Entity;
  3. use FOS\UserBundle\Entity\User as BaseUser;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use \Doctrine\Common\Collections\ArrayCollection;
  6. /**
  7. * Cet entité est l'utilisateur ayant effectué la requête.
  8. *
  9. * @ORM\Entity
  10. * @ORM\Table(name="m_user")
  11. * @ORM\Entity(repositoryClass="Muzich\CoreBundle\Repository\UserRepository")
  12. */
  13. class User extends BaseUser
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\Column(type="integer")
  18. * @ORM\generatedValue(strategy="AUTO")
  19. */
  20. protected $id;
  21. /**
  22. * Cet attribut contient les enregistrements UsersTagsFavorites lié
  23. * a cet utilisateur dans le cadre des Tags Favoris.
  24. *
  25. * @ORM\OneToMany(targetEntity="UsersTagsFavorites", mappedBy="user")
  26. */
  27. protected $tags_favorites;
  28. /**
  29. * Cet attribut contient les enregistrements UsersElementsFavorites lié
  30. * a cet utilisateur dans le cadre des éléments Favoris.
  31. *
  32. * @ORM\OneToMany(targetEntity="UsersElementsFavorites", mappedBy="user")
  33. */
  34. protected $elements_favorites;
  35. /**
  36. * Liste des Elements appartenant a cet utilisateur.
  37. *
  38. * @ORM\OneToMany(targetEntity="Element", mappedBy="owner")
  39. */
  40. protected $elements;
  41. /**
  42. * Users que cet utilisateur suit.
  43. *
  44. * @ORM\OneToMany(targetEntity="FollowUser", mappedBy="follower")
  45. */
  46. protected $followeds_users;
  47. /**
  48. * Users qui suivent cet utilisateur.
  49. *
  50. * @ORM\OneToMany(targetEntity="FollowUser", mappedBy="followed")
  51. */
  52. protected $followers_users;
  53. /**
  54. * Cet attribut contient les enregistrements FollowGroup lié
  55. * a cet utilisateur dans le cadre des groupes suivis.
  56. *
  57. * @ORM\OneToMany(targetEntity="FollowGroup", mappedBy="user")
  58. */
  59. protected $followed_groups;
  60. /**
  61. * Liste des Groupes appartenant a cet utilisateur.
  62. *
  63. * @ORM\OneToMany(targetEntity="Group", mappedBy="owner")
  64. */
  65. protected $groups_owned;
  66. /**
  67. *
  68. */
  69. public function __construct()
  70. {
  71. $this->tags_favorites = new ArrayCollection();
  72. $this->elements = new ArrayCollection();
  73. $this->elements_favorites = new ArrayCollection();
  74. $this->followeds_users = new ArrayCollection();
  75. $this->followers_users = new ArrayCollection();
  76. $this->followed_groups = new ArrayCollection();
  77. $this->groups = new ArrayCollection();
  78. parent::__construct();
  79. }
  80. /**
  81. * Get id
  82. *
  83. * @return integer
  84. */
  85. public function getId()
  86. {
  87. return $this->id;
  88. }
  89. /**
  90. * Get tags_favorites
  91. *
  92. * @return Doctrine\Common\Collections\Collection
  93. */
  94. public function getTagsFavorites()
  95. {
  96. return $this->tags_favorites;
  97. }
  98. /**
  99. * Add tags_favorites
  100. *
  101. * @param UsersTagsFavorites $tagsFavorites
  102. */
  103. public function addUsersTagsFavorites(UsersTagsFavorites $tagsFavorites)
  104. {
  105. $this->tags_favorites[] = $tagsFavorites;
  106. }
  107. /**
  108. * Add elements_favorites
  109. *
  110. * @param UsersElementsFavorites $elementsFavorites
  111. */
  112. public function addUsersElementsFavorites(UsersElementsFavorites $elementsFavorites)
  113. {
  114. $this->elements_favorites[] = $elementsFavorites;
  115. }
  116. /**
  117. * Get elements_favorites
  118. *
  119. * @return Doctrine\Common\Collections\Collection
  120. */
  121. public function getElementsFavorites()
  122. {
  123. return $this->elements_favorites;
  124. }
  125. /**
  126. * Add elements
  127. *
  128. * @param Element $elements
  129. */
  130. public function addElement(Element $elements)
  131. {
  132. $this->elements[] = $elements;
  133. }
  134. /**
  135. * Get elements
  136. *
  137. * @return Doctrine\Common\Collections\Collection
  138. */
  139. public function getElements()
  140. {
  141. return $this->elements;
  142. }
  143. /**
  144. * Add followeds_users
  145. *
  146. * @param FollowUser $followedsUsers
  147. */
  148. public function addFollowUser(FollowUser $followedsUsers)
  149. {
  150. $this->followeds_users[] = $followedsUsers;
  151. }
  152. /**
  153. * Get followeds_users
  154. *
  155. * @return Doctrine\Common\Collections\Collection
  156. */
  157. public function getFollowedsUsers()
  158. {
  159. return $this->followeds_users;
  160. }
  161. /**
  162. * Get followers_users
  163. *
  164. * @return Doctrine\Common\Collections\Collection
  165. */
  166. public function getFollowersUsers()
  167. {
  168. return $this->followers_users;
  169. }
  170. /**
  171. * Add followed_groups
  172. *
  173. * @param FollowGroup $followedGroups
  174. */
  175. public function addFollowGroup(FollowGroup $followedGroups)
  176. {
  177. $this->followed_groups[] = $followedGroups;
  178. }
  179. /**
  180. * Get followed_groups
  181. *
  182. * @return Doctrine\Common\Collections\Collection
  183. */
  184. public function getFollowedGroups()
  185. {
  186. return $this->followed_groups;
  187. }
  188. /**
  189. * Add groups
  190. *
  191. * @param Group $groups
  192. */
  193. public function addGroupOwned(Group $groups)
  194. {
  195. $this->groups[] = $groups;
  196. }
  197. /**
  198. * Get groups
  199. *
  200. * @return Doctrine\Common\Collections\Collection
  201. */
  202. public function getGroupsOnwed()
  203. {
  204. return $this->groups;
  205. }
  206. /*
  207. *
  208. *
  209. */
  210. }