public function update(DocumentInterface $document)
    {
        if (!$document->getId()) {
            return false;
        }

        $oldPath = $this->getPathForDocument($document->getInitialId());

        if(!file_exists($oldPath)) {
            return false;
        }

        // If the ID has changed we need to delete the old document.
        if($document->getId() !== $document->getInitialId()) {
            if(file_exists($oldPath)) {
                unlink($oldPath);
            }
        }

        return $this->store($document);
    }
public function update(DocumentInterface $document)
    {
        if (!$document->getId()) {
            return false;
        }

        $oldPath = $this->getPathForDocument($document->getInitialId());

        if(!file_exists($oldPath)) {
            return false;
        }

        // If the ID has changed we need to delete the old document.
        if($document->getId() !== $document->getInitialId()) {
            if(file_exists($oldPath)) {
                unlink($oldPath);
            }
        }

        return $this->store($document);
    }
public function update ( DocumentInterface $ document ) { if ( ! $ document -> getId ( ) ) { return false ; } $ oldPath = $ this -> getPathForDocument ( $ document -> getInitialId ( ) ) ; if ( ! file_exists ( $ oldPath ) ) { return false ; } // If the ID has changed we need to delete the old document. if ( $ document -> getId ( ) !== $ document -> getInitialId ( ) ) { if ( file_exists ( $ oldPath ) ) { unlink ( $ oldPath ) ; } } return $ this -> store ( $ document ) ; }
Store a Document in the repository, but only if it already
exists. The document must have an ID.

@param Document $document The document to store

@return bool True if stored, otherwise false
Store a Document in the repository but only if it already exists . The document must have an ID .