tags_favorites = new ArrayCollection(); $this->elements = new ArrayCollection(); $this->elements_favorites = new ArrayCollection(); $this->followeds_users = new ArrayCollection(); $this->followers_users = new ArrayCollection(); $this->followed_groups = new ArrayCollection(); $this->groups = new ArrayCollection(); parent::__construct(); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Get tags_favorites * * @return Doctrine\Common\Collections\Collection */ public function getTagsFavorites() { return $this->tags_favorites; } /** * Add tags_favorites * * @param UsersTagsFavorites $tagsFavorites */ public function addUsersTagsFavorites(UsersTagsFavorites $tagsFavorites) { $this->tags_favorites[] = $tagsFavorites; } /** * Add elements_favorites * * @param UsersElementsFavorites $elementsFavorites */ public function addUsersElementsFavorites(UsersElementsFavorites $elementsFavorites) { $this->elements_favorites[] = $elementsFavorites; } /** * Get elements_favorites * * @return Doctrine\Common\Collections\Collection */ public function getElementsFavorites() { return $this->elements_favorites; } /** * Add elements * * @param Element $elements */ public function addElement(Element $elements) { $this->elements[] = $elements; } /** * Get elements * * @return Doctrine\Common\Collections\Collection */ public function getElements() { return $this->elements; } /** * Add followeds_users * * @param FollowUser $followedsUsers */ public function addFollowUser(FollowUser $followedsUsers) { $this->followeds_users[] = $followedsUsers; } /** * Get followeds_users * * @return Doctrine\Common\Collections\Collection */ public function getFollowedsUsers() { $users = array(); foreach ($this->followeds_users as $follow_user) { $users[] = $follow_user->getFollowed(); } return $users; } /** * Get followers_users * * @return Doctrine\Common\Collections\Collection */ public function getFollowersUsers() { $users = array(); foreach ($this->followers_users as $follow_user) { $users[] = $follow_user->getFollower(); } return $users; } /** * Add followed_groups * * @param FollowGroup $followedGroups */ public function addFollowGroup(FollowGroup $followedGroups) { $this->followed_groups[] = $followedGroups; } /** * Get followed_groups * * @return Doctrine\Common\Collections\Collection */ public function getFollowedGroups() { $groups = array(); foreach ($this->followed_groups as $follow_group) { $groups[] = $follow_group->getGroup(); } return $groups; } /** * Add groups * * @param Group $groups */ public function addGroupOwned(Group $groups) { $this->groups[] = $groups; } /** * Get groups * * @return Doctrine\Common\Collections\Collection */ public function getGroupsOnwed() { return $this->groups; } public function getSlug() { return $this->slug; } public function setSlug($slug) { $this->slug = $slug; } /* * * */ public function getName() { return $this->getUsername(); } /** * Retourn si l'user_id transmis fait partis des enregistrements * followed de l'objet. * * @param int $user_id * @return boolean */ public function isFollowingUser($user_id) { foreach ($this->followeds_users as $followed_user) { if ($followed_user->getFollowed()->getId() == $user_id) { return true; } } return false; } /** * Retourn si l'user_id transmis est l'un des User suivis * * @param Symfony\Bundle\DoctrineBundle\Registry doctrine * @param int $user_id * @return boolean */ public function isFollowingUserByQuery($doctrine, $user_id) { return $doctrine ->getRepository('MuzichCoreBundle:User') ->isFollowingUser($this->getId(), $user_id) ; } /** * Retourn si l'group_id transmis est l'un des groupe suivis * * @param Symfony\Bundle\DoctrineBundle\Registry doctrine * @param int $user_id * @return boolean */ public function isFollowingGroupByQuery($doctrine, $group_id) { return $doctrine ->getRepository('MuzichCoreBundle:User') ->isFollowingGroup($this->getId(), $group_id) ; } }