PHP Класс Sokil\Mongo\Client

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $dsn = null, array $options = null )
__get ( $name )
createPersistence ( ) : Sokil\Mongo\Persistence Create new persistence manager
debug ( $enabled = true ) Enable or disable debug mode
getCollection ( string $name ) : Collection Get collection from previously selected database by self::useDatabase()
getConnectOptions ( )
getConnections ( ) : array Get list of all active connections through this client
getCurrentDatabaseName ( ) : string Get name of current database
getDatabase ( string $name = null ) : Database Get database instance
getDbVersion ( ) : string
getDsn ( )
getLogger ( ) : Psr\Log\LoggerInterface
getMongoClient ( ) : MongoClient Get mongo connection instance
getReadPreference ( )
getVersion ( ) : string
getWriteConcern ( ) : string | integer Get currently active write concern on connection level
hasLogger ( ) : boolean Check if logger defined
isDebugEnabled ( ) Check state of debug mode
map ( array $mapping ) : Client Map database and collection name to class.
readNearest ( array $tags = null )
readPrimaryOnly ( )
readPrimaryPreferred ( array $tags = null )
readSecondaryOnly ( array $tags = null )
readSecondaryPreferred ( array $tags = null )
removeLogger ( ) : Client Remove logger
setConnectOptions ( array $options ) : Client Set connect options
setCredentials ( type $username, type $password ) : Client Set credentials to auth on db, specified in connect options or dsn.
setDsn ( $dsn )
setLogger ( Psr\Log\LoggerInterface $logger )
setMajorityWriteConcern ( integer $timeout = 10000 ) : Client Define majority write concern on whole requests
setMongoClient ( MongoClient $client ) : Client Set mongo's client
setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : Client Define unacknowledged write concern on whole requests
setWriteConcern ( string | integer $w, integer $timeout = 10000 ) : Client Define write concern on whole requests
useDatabase ( string $name ) : Client Select database

Описание методов

__construct() публичный Метод

public __construct ( string $dsn = null, array $options = null )
$dsn string Data Source Name
$options array

__get() публичный Метод

public __get ( $name )

createPersistence() публичный Метод

Create new persistence manager
public createPersistence ( ) : Sokil\Mongo\Persistence
Результат Sokil\Mongo\Persistence

debug() публичный Метод

Enable or disable debug mode
public debug ( $enabled = true )

getCollection() публичный Метод

Get collection from previously selected database by self::useDatabase()
public getCollection ( string $name ) : Collection
$name string
Результат Collection

getConnectOptions() публичный Метод

public getConnectOptions ( )

getConnections() публичный Метод

Get list of all active connections through this client
public getConnections ( ) : array
Результат array

getCurrentDatabaseName() публичный Метод

Get name of current database
public getCurrentDatabaseName ( ) : string
Результат string

getDatabase() публичный Метод

Get database instance
public getDatabase ( string $name = null ) : Database
$name string database name
Результат Database

getDbVersion() публичный Метод

public getDbVersion ( ) : string
Результат string version of mongo database

getDsn() публичный Метод

public getDsn ( )

getLogger() публичный Метод

public getLogger ( ) : Psr\Log\LoggerInterface
Результат Psr\Log\LoggerInterface

getMongoClient() публичный Метод

Get mongo connection instance
public getMongoClient ( ) : MongoClient
Результат MongoClient

getReadPreference() публичный Метод

public getReadPreference ( )

getVersion() публичный Метод

public getVersion ( ) : string
Результат string Version of PHP driver

getWriteConcern() публичный Метод

Get currently active write concern on connection level
public getWriteConcern ( ) : string | integer
Результат string | integer

hasLogger() публичный Метод

Check if logger defined
public hasLogger ( ) : boolean
Результат boolean

isDebugEnabled() публичный Метод

Check state of debug mode
public isDebugEnabled ( )

map() публичный Метод

Collection name -> array definition: ['acmeDatabaseName' => ['acmeCollectionName' => ['class' => '\Acme\Collection\SomeCollectionClass']]] Collection name -> collection class name (deprecated: use definition array): ['acmeDatabaseName' => ['acmeCollectionName' => '\Acme\Collection\SomeCollectionClass']] Collection's class namespace (deprecated: use definition array): ['acmeDatabaseName' => '\Acme\Collection']
public map ( array $mapping ) : Client
$mapping array classpath or class prefix
Результат Client

readNearest() публичный Метод

public readNearest ( array $tags = null )
$tags array

readPrimaryOnly() публичный Метод

public readPrimaryOnly ( )

readPrimaryPreferred() публичный Метод

public readPrimaryPreferred ( array $tags = null )
$tags array

readSecondaryOnly() публичный Метод

public readSecondaryOnly ( array $tags = null )
$tags array

readSecondaryPreferred() публичный Метод

public readSecondaryPreferred ( array $tags = null )
$tags array

removeLogger() публичный Метод

Remove logger
public removeLogger ( ) : Client
Результат Client

setConnectOptions() публичный Метод

Set connect options
public setConnectOptions ( array $options ) : Client
$options array
Результат Client

setCredentials() публичный Метод

If not specified - auth on admin db
public setCredentials ( type $username, type $password ) : Client
$username type
$password type
Результат Client

setDsn() публичный Метод

public setDsn ( $dsn )

setLogger() публичный Метод

public setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

setMajorityWriteConcern() публичный Метод

Define majority write concern on whole requests
public setMajorityWriteConcern ( integer $timeout = 10000 ) : Client
$timeout integer timeout in milliseconds
Результат Client

setMongoClient() публичный Метод

Set mongo's client
public setMongoClient ( MongoClient $client ) : Client
$client MongoClient
Результат Client

setUnacknowledgedWriteConcern() публичный Метод

Define unacknowledged write concern on whole requests
public setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : Client
$timeout integer timeout in milliseconds
Результат Client

setWriteConcern() публичный Метод

Define write concern on whole requests
public setWriteConcern ( string | integer $w, integer $timeout = 10000 ) : Client
$w string | integer write concern
$timeout integer timeout in milliseconds
Результат Client

useDatabase() публичный Метод

Select database
public useDatabase ( string $name ) : Client
$name string
Результат Client