Свойство | Тип | Описание | |
---|---|---|---|
$connection | object | The MongoDB object instance. | |
$server | object | The Mongo class instance. |
Свойство | Тип | Описание | |
---|---|---|---|
$_autoConfig | array | List of configuration keys which will be automatically assigned to their corresponding protected class properties. | |
$_boolean | array | List of comparison operators to use when performing boolean logic in a query. | |
$_classes | array | Classes used by this class. | |
$_operators | Map of typical SQL-like operators to their MongoDB equivalents. | ||
$_schema | Closure | A closure or anonymous function which receives an instance of this class, a collection name and associated meta information, and returns an array defining the schema for an associated model, where the keys are field names, and the values are arrays defining the type information for each field. At a minimum, type arrays must contain a 'type' key. For more information on schema definitions, and an example schema callback implementation, see the $_schema property of the Model class. |
Метод | Описание | |
---|---|---|
__call ( string $method, array $params ) : mixed | A method dispatcher that allows direct calls to native methods in PHP's Mongo object. Read more here: http://php.net/manual/class.mongo.php | |
__construct ( array $config = [] ) : void | Constructor. | |
__destruct ( ) : void | Destructor. Ensures that the server connection is closed and resources are freed when the adapter instance is destroyed. | |
calculation ( string $type, mixed $query, array $options = [] ) : integer | Executes calculation-related queries, such as those required for count. | |
conditions ( array $conditions, object $context ) : array | Maps incoming conditions with their corresponding MongoDB-native operators. | |
configureClass ( string $class ) : Returns | Configures a model class by overriding the default dependencies for 'set' and 'entity' , and sets the primary key to '_id', in keeping with Mongo's conventions. | |
connect ( ) : boolean | Connects to the Mongo server. Matches up parameters from the constructor to create a Mongo database connection. | |
create ( string $query, array $options = [] ) : boolean | Create new document | |
delete ( string $query, array $options = [] ) : boolean | Delete document | |
describe ( mixed $collection, mixed $fields = [], array $meta = [] ) : array | Gets the column 'schema' for a given MongoDB collection. Only returns a schema if the 'schema' configuration flag has been set in the constructor. | |
disconnect ( ) : boolean | Disconnect from the Mongo server. | |
enabled ( string $feature = null ) : boolean | With no parameter, checks to see if the mongo extension is installed. With a parameter, queries for a specific supported feature. | |
fields ( array $fields, object $context ) : array | Return formatted identifiers for fields. | |
group ( string | array $group, object $context ) : array | Formats group clauses for MongoDB. | |
limit ( mixed $limit, object $context ) : mixed | Return formatted clause for limit. | |
name ( string $name ) : string | Quotes identifiers. | |
order ( mixed $order, object $context ) : mixed | Return formatted clause for order. | |
read ( string $query, array $options = [] ) : object | Read from document | |
relationFieldName ( $type, $name ) : string | Returns the field name of a relation name (camelBack). | |
relationship ( string $class, string $type, string $name, array $config = [] ) : array | Document relationships. | |
respondsTo ( string $method, boolean $internal = false ) : boolean | Determines if a given method can be called. | |
schema ( $query, $resource = null, $context = null ) : array | Normally used in cases where the query is a raw string (as opposed to a Query object), to database must determine the correct column names from the result resource. Not applicable to this data source. | |
sources ( string $class = null ) : array | Returns the list of collections in the currently-connected database. | |
update ( string $query, array $options = [] ) : boolean | Update document |
Метод | Описание | |
---|---|---|
_checkConnection ( ) | ||
_conditions ( array $conditions, string $model, object $schema, object $context ) : array | Protected helper method used to format conditions. | |
_deleteFile ( $conditions, $options = [] ) | ||
_group ( $group, $args, $options ) | ||
_init ( ) : void | Initializer. Adds operator handlers which will later allow to correctly cast any values. | |
_isMongoCode ( $conditions ) | ||
_ok ( $result ) : boolean |
Parse a MongoCollection:: |
|
_operators ( $field, $operators, $schema ) | ||
_saveFile ( $data ) |
public __call ( string $method, array $params ) : mixed | ||
$method | string | The name of native method to call. See the link above for available class methods. |
$params | array | A list of parameters to be passed to the native method. |
Результат | mixed | The return value of the native method specified in `$method`. |
public __construct ( array $config = [] ) : void | ||
$config | array | Configuration options required to connect to the database, including: - `'database'` _string_: The name of the database to connect to. Defaults to `null`. - `'host'` _string_: The IP or machine name where Mongo is running, followed by a colon, and the port number. Defaults to `'localhost:27017'`. - `'persistent'` _mixed_: Determines a persistent connection to attach to. See the `$options` parameter of [`Mongo::__construct()`](http://php.net/mongo.construct.php) for more information. Defaults to `false`, meaning no persistent connection is made. - `'timeout'` _integer_: The number of milliseconds a connection attempt will wait before timing out and throwing an exception. Defaults to `100`. - `'schema'` _\Closure_: A closure or anonymous function which returns the schema information for a model class. See the `$_schema` property for more information. - `'gridPrefix'` _string_: The default prefix for MongoDB's `chunks` and `files` collections. Defaults to `'fs'`. - `'replicaSet'` _string_: See the documentation for `Mongo::__construct()`. Defaults to `false`. - `'readPreference'` _mixed_: May either be a single value such as Mongo::RP_NEAREST, or an array containing a read preference and a tag set such as: array(Mongo::RP_SECONDARY_PREFERRED, array('dc' => 'east) See the documentation for `Mongo::setReadPreference()`. Defaults to null. Typically, these parameters are set in `Connections::add()`, when adding the adapter to the list of active connections. |
Результат | void |
public __destruct ( ) : void | ||
Результат | void |
protected _conditions ( array $conditions, string $model, object $schema, object $context ) : array | ||
$conditions | array | The conditions array to be processed. |
$model | string | The name of the model class used in the query. |
$schema | object | The object containing the schema definition. |
$context | object | The `Query` object. |
Результат | array | Processed query conditions. |
public calculation ( string $type, mixed $query, array $options = [] ) : integer | ||
$type | string | Only accepts `count`. |
$query | mixed | The query to be executed. |
$options | array | Optional arguments for the `read()` query that will be executed to obtain the calculation result. |
Результат | integer | Result of the calculation. |
public configureClass ( string $class ) : Returns | ||
$class | string | The fully-namespaced model class name to be configured. |
Результат | Returns | an array containing keys `'classes'` and `'meta'`, which will be merged with their respective properties in `Model`. |
public describe ( mixed $collection, mixed $fields = [], array $meta = [] ) : array | ||
$collection | mixed | Specifies a collection name for which the schema should be queried. |
$fields | mixed | Any schema data pre-defined by the model. |
$meta | array | Any meta information pre-defined in the model. |
Результат | array | Returns an associative array describing the given collection's schema. |
public disconnect ( ) : boolean | ||
Результат | boolean | True |
public relationFieldName ( $type, $name ) : string | ||
Результат | string |
public respondsTo ( string $method, boolean $internal = false ) : boolean | ||
$method | string | Name of the method. |
$internal | boolean | Provide `true` to perform check from inside the class/object. When `false` checks also for public visibility; defaults to `false`. |
Результат | boolean | Returns `true` if the method can be called, `false` otherwise. |
protected array $_autoConfig | ||
Результат | array |
protected array $_boolean | ||
Результат | array |
protected $_operators |
protected Closure $_schema | ||
Результат | Closure |
public object $connection | ||
Результат | object |