protected function update()
    {
        $object_id = $this->getID();
        if ( empty($object_id) ) {
            throw new \Exception('Object has no ID, update() not possible');
        }

        if ( !$this->isDirty() ) {
            return $this;
        }

        $url = $this->getURL(
            'update',
            [
                'object_id' => $object_id,
            ]
        );

        $response = $this->getClient()->put(
            $url,
            $this->getUnsavedValues(),
            [
                'expand' => true,
            ]
        );
        if ( $response->hasError() ) {
            $this->setError( $response->getError() );
            return $this;
        }

        $this->clearError();
        $this->setRemoteData( $response->getData() );
        $this->clearUnsavedValues();

        return $this;
    }
protected function update()
    {
        $object_id = $this->getID();
        if ( empty($object_id) ) {
            throw new \Exception('Object has no ID, update() not possible');
        }

        if ( !$this->isDirty() ) {
            return $this;
        }

        $url = $this->getURL(
            'update',
            [
                'object_id' => $object_id,
            ]
        );

        $response = $this->getClient()->put(
            $url,
            $this->getUnsavedValues(),
            [
                'expand' => true,
            ]
        );
        if ( $response->hasError() ) {
            $this->setError( $response->getError() );
            return $this;
        }

        $this->clearError();
        $this->setRemoteData( $response->getData() );
        $this->clearUnsavedValues();

        return $this;
    }
protected function update ( ) { $ object_id = $ this -> getID ( ) ; if ( empty ( $ object_id ) ) { throw new \ Exception ( 'Object has no ID, update() not possible' ) ; } if ( ! $ this -> isDirty ( ) ) { return $ this ; } $ url = $ this -> getURL ( 'update' , [ 'object_id' => $ object_id , ] ) ; $ response = $ this -> getClient ( ) -> put ( $ url , $ this -> getUnsavedValues ( ) , [ 'expand' => true , ] ) ; if ( $ response -> hasError ( ) ) { $ this -> setError ( $ response -> getError ( ) ) ; return $ this ; } $ this -> clearError ( ) ; $ this -> setRemoteData ( $ response -> getData ( ) ) ; $ this -> clearUnsavedValues ( ) ; return $ this ; }
Updates an existing object with the current data.

@return object      This object
Updates an existing object with the current data .