public function addRole($role) { !$role instanceof Role && ($role = new Role($role)); $role->addUser($this, false); $this->roles->add($role); return $this; }
/** * Returns the roles granted to the user. * * <code> * public function getRoles() * { * return array('ROLE_USER'); * } * </code> * * Alternatively, the roles might be stored on a ``roles`` property, * and populated in any number of different ways when the user object * is created. * * @return Role[] The user roles */ public function getRoles() { return array($this->role->getRole()); }