AmyUser::save PHP Method

save() public method

public save ( )
    public function save()
    {
        $sql = 'UPDATE amy.users SET ';
        foreach ($this->credentials as $key => $value) {
            $sql .= $key . "='" . Db::quote_literal($value) . "', ";
        }
        $sql = substr($sql, 0, -2) . ' WHERE id=' . $this->userId;
        if (false === Db::find($sql)) {
            throw new Exception("Unable to save user credentials: " . Db::last_error());
        }
        if (is_object($this->session)) {
            $this->save_user_to_session($this->session);
        }
        return $this;
    }