Commit 6e84d2ff authored by Will Banfield's avatar Will Banfield Committed by Jeremy Mikola

Stream registering is now totally transparent to the user

parent 2a99015a
......@@ -21,6 +21,7 @@ class Bucket
private $databaseName;
private $collectionsWrapper;
private $options;
private static $streamWrapper;
/**
* Constructs a GridFS bucket.
*
......@@ -50,6 +51,7 @@ class Bucket
$this->databaseName = (string) $databaseName;
$this->options = $options;
$this->collectionsWrapper = new GridFSCollectionsWrapper($manager, $databaseName, $options);
$this->registerStreamWrapper($manager);
}
/**
......@@ -206,4 +208,12 @@ class Bucket
}
return $file;
}
private function registerStreamWrapper($manager)
{
if(isset(Bucket::$streamWrapper)){
return;
}
Bucket::$streamWrapper = new \MongoDB\GridFS\StreamWrapper();
Bucket::$streamWrapper->register($manager);
}
}
......@@ -21,8 +21,6 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
$col = new Collection($this->manager, sprintf("%s.%s",$this->getDatabaseName(), $collection));
$col->drop();
}
$streamWrapper = new \MongoDB\GridFS\StreamWrapper();
$streamWrapper->register($this->manager);
$this->bucket = new \MongoDB\GridFS\Bucket($this->manager, $this->getDatabaseName());
$this->collectionsWrapper = $this->bucket->getCollectionsWrapper();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment