public function rename($id, $newFilename)
    {
        $updateResult = $this->collectionWrapper->updateFilenameForId($id, $newFilename);

        if ($updateResult->getModifiedCount() === 1) {
            return;
        }

        /* If the update resulted in no modification, it's possible that the
         * file did not exist, in which case we must raise an error. Checking
         * the write result's matched count will be most efficient, but fall
         * back to a findOne operation if necessary (i.e. legacy writes).
         */
        $found = $updateResult->getMatchedCount() !== null
            ? $updateResult->getMatchedCount() === 1
            : $this->collectionWrapper->findFileById($id) !== null;

        if ( ! $found) {
            throw FileNotFoundException::byId($id, $this->getFilesNamespace());
        }
    }
public function rename($id, $newFilename)
    {
        $updateResult = $this->collectionWrapper->updateFilenameForId($id, $newFilename);

        if ($updateResult->getModifiedCount() === 1) {
            return;
        }

        /* If the update resulted in no modification, it's possible that the
         * file did not exist, in which case we must raise an error. Checking
         * the write result's matched count will be most efficient, but fall
         * back to a findOne operation if necessary (i.e. legacy writes).
         */
        $found = $updateResult->getMatchedCount() !== null
            ? $updateResult->getMatchedCount() === 1
            : $this->collectionWrapper->findFileById($id) !== null;

        if ( ! $found) {
            throw FileNotFoundException::byId($id, $this->getFilesNamespace());
        }
    }
public function rename ( $ id , $ newFilename ) { $ updateResult = $ this -> collectionWrapper -> updateFilenameForId ( $ id , $ newFilename ) ; if ( $ updateResult -> getModifiedCount ( ) === 1 ) { return ; } /* If the update resulted in no modification, it's possible that the
         * file did not exist, in which case we must raise an error. Checking
         * the write result's matched count will be most efficient, but fall
         * back to a findOne operation if necessary (i.e. legacy writes).
         */ $ found = $ updateResult -> getMatchedCount ( ) !== null ? $ updateResult -> getMatchedCount ( ) === 1 : $ this -> collectionWrapper -> findFileById ( $ id ) !== null ; if ( ! $ found ) { throw FileNotFoundException :: byId ( $ id , $ this -> getFilesNamespace ( ) ) ; } }
Renames the GridFS file with the specified ID.

@param mixed  $id          File ID
@param string $newFilename New filename
@throws FileNotFoundException if no file could be selected
@throws DriverRuntimeException for other driver errors (e.g. connection errors)
Renames the GridFS file with the specified ID .