user = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Set name * * @param string $name * @return Role */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Add user * * @param \AppBundle\Entity\Usuarios $user * @return Role */ public function addUser(\AppBundle\Entity\Usuarios $user) { $this->user[] = $user; return $this; } /** * Remove user * * @param \AppBundle\Entity\Usuarios $user */ public function removeUser(\AppBundle\Entity\Usuarios $user) { $this->user->removeElement($user); } /** * Get user * * @return \Doctrine\Common\Collections\Collection */ public function getUser() { return $this->user; } public function getRole() { return $this->getName(); } public function __toString() { return $this->getRole(); } /** * @see \Serializable::serialize() */ public function serialize() { /* * ! Don't serialize $users field ! */ return \serialize(array( $this->id, $this->name )); } /** * @see \Serializable::unserialize() */ public function unserialize($serialized) { list( $this->id, $this->name ) = \unserialize($serialized); } }