rol = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Set username * * @param string $username * @return Usuarios */ public function setUsername($username) { $this->username = $username; return $this; } /** * Get username * * @return string */ public function getUsername() { return $this->username; } /** * Set username * * @param string $email * @return Usuarios */ public function setEmail($email) { $this->email = $email; return $this; } /** * Get email * * @return string */ public function getEmail() { return $this->email; } /** * Set password * * @param string $password * @return Usuarios */ public function setPassword($password) { $this->password = $password; return $this; } /** * Get password * * @return string */ public function getPassword() { return $this->password; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set idRolInstitucion * * @param \AppBundle\Entity\RolInstitucion $idRolInstitucion * @return Usuarios */ public function setIdRolInstitucion(\AppBundle\Entity\RolInstitucion $idRolInstitucion = null) { $this->idRolInstitucion = $idRolInstitucion; return $this; } /** * Get idRolInstitucion * * @return \AppBundle\Entity\RolInstitucion */ public function getIdRolInstitucion() { return $this->idRolInstitucion; } /** * Add rol * * @param \AppBundle\Entity\Role $rol * @return Role */ public function addRol(\AppBundle\Entity\Role $rol) { $this->rol[] = $rol; return $this; } /** * Remove rol * * @param \AppBundle\Entity\Role $rol */ public function removeRol(\AppBundle\Entity\Role $rol) { $this->rol->removeElement($rol); } /** * Get rol * * @return \Doctrine\Common\Collections\Collection */ public function getRol() { return $this->rol; } public function getRoles() { return $this->rol->toArray(); /*IMPORTANTE: el mecanismo de seguridad de Sf2 requiere ésto como un array*/ } public function equals(UserInterface $user) { return md5($this->getUsername()) == md5($user->getUsername()); } /** * Erases the user credentials. */ public function eraseCredentials() { } public function serialize() { /* * ! Don't serialize $roles field ! */ return \serialize(array( $this->id, $this->username, $this->password, )); } /** * @see \Serializable::unserialize() */ public function unserialize($serialized) { list ( $this->id, $this->username, $this->password, ) = \unserialize($serialized); } public function __toString() { return $this->getuserName(); } public function getPlainPassword() { return $this->plainPassword; } public function setPlainPassword($password) { $this->plainPassword = $password; } public function isGranted($rol) { return in_array($rol, $this->getRoles()); } /** * Returns the salt that was originally used to encode the password. * * This can return null if the password was not encoded using a salt. * * @return string|null The salt */ public function getSalt() { // TODO: Implement getSalt() method. } }