Skip to content

Documentation fixes #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/BulkWriteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@
*/
class BulkWriteResult
{
/**
* @var WriteResult
*/
private $writeResult;

/**
* @var array
*/
private $insertedIds;

/**
* @var boolean
*/
private $isAcknowledged;

/**
Expand Down
18 changes: 16 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,28 @@

class Client
{
/**
* @var array
*/
private static $defaultTypeMap = [
'array' => 'MongoDB\Model\BSONArray',
'document' => 'MongoDB\Model\BSONDocument',
'root' => 'MongoDB\Model\BSONDocument',
];

/**
* @var Manager
*/
private $manager;

/**
* @var string
*/
private $uri;

/**
* @var array
*/
private $typeMap;

/**
Expand Down Expand Up @@ -62,7 +76,7 @@ public function __construct($uri = 'mongodb://localhost:27017', array $uriOption
* Return internal properties for debugging purposes.
*
* @see http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo
* @param array
* @return array
*/
public function __debugInfo()
{
Expand Down Expand Up @@ -93,7 +107,7 @@ public function __get($databaseName)
/**
* Return the connection string (i.e. URI).
*
* @param string
* @return string
*/
public function __toString()
{
Expand Down
35 changes: 33 additions & 2 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,50 @@

class Collection
{
/**
* @var array
*/
private static $defaultTypeMap = [
'array' => 'MongoDB\Model\BSONArray',
'document' => 'MongoDB\Model\BSONDocument',
'root' => 'MongoDB\Model\BSONDocument',
];

private static $wireVersionForFindAndModifyWriteConcern = 4;

/**
* @var string
*/
private $collectionName;

/**
* @var string
*/
private $databaseName;

/**
* @var Manager
*/
private $manager;

/**
* @var ReadConcern
*/
private $readConcern;

/**
* @var ReadPreference
*/
private $readPreference;

/**
* @var array
*/
private $typeMap;

/**
* @var WriteConcern
*/
private $writeConcern;

/**
Expand Down Expand Up @@ -117,7 +148,7 @@ public function __construct(Manager $manager, $databaseName, $collectionName, ar
* Return internal properties for debugging purposes.
*
* @see http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo
* @param array
* @return array
*/
public function __debugInfo()
{
Expand All @@ -136,7 +167,7 @@ public function __debugInfo()
* Return the collection namespace (e.g. "db.collection").
*
* @see https://docs.mongodb.org/manual/faq/developers/#faq-dev-namespace
* @param string
* @return string
*/
public function __toString()
{
Expand Down
30 changes: 28 additions & 2 deletions src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,43 @@

class Database
{
/**
* @var array
*/
private static $defaultTypeMap = [
'array' => 'MongoDB\Model\BSONArray',
'document' => 'MongoDB\Model\BSONDocument',
'root' => 'MongoDB\Model\BSONDocument',
];

/**
* @var string
*/
private $databaseName;

/**
* @var Manager
*/
private $manager;

/**
* @var ReadConcern
*/
private $readConcern;

/**
* @var ReadPreference
*/
private $readPreference;

/**
* @var array
*/
private $typeMap;

/**
* @var WriteConcern
*/
private $writeConcern;

/**
Expand Down Expand Up @@ -94,7 +120,7 @@ public function __construct(Manager $manager, $databaseName, array $options = []
* Return internal properties for debugging purposes.
*
* @see http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo
* @param array
* @return array
*/
public function __debugInfo()
{
Expand Down Expand Up @@ -128,7 +154,7 @@ public function __get($collectionName)
/**
* Return the database name.
*
* @param string
* @return string
*/
public function __toString()
{
Expand Down
7 changes: 7 additions & 0 deletions src/DeleteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
*/
class DeleteResult
{
/**
* @var WriteResult
*/
private $writeResult;

/**
* @var boolean
*/
private $isAcknowledged;

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Exception/GridFSFileNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

class GridFSFileNotFoundException extends \MongoDB\Driver\Exception\RuntimeException implements Exception
{
/**
* @param string $filename
* @param integer $namespace
*/
public function __construct($filename, $namespace)
{
parent::__construct(sprintf('Unable to find file "%s" in namespace "%s"', $filename, $namespace));
Expand Down
26 changes: 26 additions & 0 deletions src/GridFS/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,24 @@
*/
class Bucket
{
/**
* @var StreamWrapper
*/
private static $streamWrapper;

/**
* @var GridFSCollectionsWrapper
*/
private $collectionsWrapper;

/**
* @var string
*/
private $databaseName;

/**
* @var array
*/
private $options;

/**
Expand Down Expand Up @@ -318,6 +332,11 @@ public function uploadFromStream($filename, $source, array $options = [])
return $gridFsStream->uploadFromStream($source);
}

/**
* @param string $filename
* @param integer $revision
* @return mixed
*/
private function findFileRevision($filename, $revision)
{
if ($revision < 0) {
Expand Down Expand Up @@ -345,6 +364,10 @@ private function findFileRevision($filename, $revision)
return $file;
}

/**
* @param string $file
* @return resource
*/
private function openDownloadStreamByFile($file)
{
$options = [
Expand All @@ -357,6 +380,9 @@ private function openDownloadStreamByFile($file)
return fopen(sprintf('gridfs://%s/%s', $this->databaseName, $file->filename), 'r', false, $context);
}

/**
* @param Manager $manager
*/
private function registerStreamWrapper(Manager $manager)
{
if (isset(self::$streamWrapper)) {
Expand Down
1 change: 1 addition & 0 deletions src/GridFS/GridFSCollectionsWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use MongoDB\Driver\Manager;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern;
use MongoDB\Exception\InvalidArgumentException;

/**
* GridFSCollectionsWrapper abstracts the GridFS files and chunks collections.
Expand Down
Loading