public function __construct(GridFS $gridFS, $file = null)
{
$this->gridFS = $gridFS;
if (!$file) {
return;
}
if (is_array($file)) {
$file = new \MongoGridFSFile($gridFS->getMongoCollection(), $file);
} elseif (!$file instanceof \MongoGridFSFile) {
throw new Exception('Wrong file data specified');
}
$this->file = $file;
$this->setDataReference($file->file);
}