users = new ArrayCollection(); } /** * @return string */ public function __toString() { return (string) $this->getName(); } /** * @return ArrayCollection */ public function getUsers() { return $this->users; } /** * @param $users */ public function setUsers($users) { $this->users = new ArrayCollection(); foreach ($users as $user) { $this->addUsers($user); } } public function addUsers(UsergroupRelUser $user) { $user->setUsergroup($this); $this->users[] = $user; } /** * Remove $user. */ public function removeUsers(UsergroupRelUser $user) { foreach ($this->users as $key => $value) { if ($value->getId() == $user->getId()) { unset($this->users[$key]); } } } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set name. * * @param string $name * * @return Usergroup */ public function setName($name) { $this->name = $name; return $this; } /** * Get name. * * @return string */ public function getName() { return $this->name; } /** * Set description. * * @param string $description * * @return Usergroup */ public function setDescription($description) { $this->description = $description; return $this; } /** * Get description. * * @return string */ public function getDescription() { return $this->description; } /** * @return int */ public function getGroupType() { return $this->groupType; } /** * @param int $groupType * * @return Usergroup */ public function setGroupType($groupType) { $this->groupType = $groupType; return $this; } }