Phalcon\Db\Adapter\MongoDB\GridFS\Exception\FileNotFoundException::byFilenameAndRevision PHP Метод

byFilenameAndRevision() публичный статический Метод

Thrown when a file cannot be found by its filename and revision.
public static byFilenameAndRevision ( string $filename, integer $revision, string $namespace ) : self
$filename string Filename
$revision integer Revision
$namespace string Namespace for the files collection
Результат self
    public static function byFilenameAndRevision($filename, $revision, $namespace)
    {
        return new static(sprintf('File with name "%s" and revision "%d" not found in "%s"', $filename, $revision, $namespace));
    }

Usage Example

Пример #1
0
 /**
  * Opens a readable stream stream to read a GridFS file, which is selected
  * by name and revision.
  *
  * Supported options:
  *
  *  * revision (integer): Which revision (i.e. documents with the same
  *    filename and different uploadDate) of the file to retrieve. Defaults
  *    to -1 (i.e. the most recent revision).
  *
  * Revision numbers are defined as follows:
  *
  *  * 0 = the original stored file
  *  * 1 = the first revision
  *  * 2 = the second revision
  *  * etc…
  *  * -2 = the second most recent revision
  *  * -1 = the most recent revision
  *
  * @param string $filename Filename
  * @param array  $options Download options
  *
  * @return resource
  * @throws FileNotFoundException
  */
 public function openDownloadStreamByName($filename, array $options = [])
 {
     $options += ['revision' => -1];
     $file = $this->collectionWrapper->findFileByFilenameAndRevision($filename, $options['revision']);
     if ($file === null) {
         throw FileNotFoundException::byFilenameAndRevision($filename, $options['revision'], $this->getFilesNamespace());
     }
     return $this->openDownloadStreamByFile($file);
 }
FileNotFoundException