PHP Class lithium\data\source\http\adapter\CouchDb

Inheritance: extends lithium\data\source\Http
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Свойство Type Description
$_classes array Classes used by CouchDb.
$_db boolean True if Database exists.
$_handlers
$_iterator string Increment value of current result set loop used by result to handle rows of json responses.

Méthodes publiques

Méthode Description
__call ( string $method, array $params = [] ) : mixed Magic for passing methods to http service.
__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 ( string $conditions, string $context ) : array Handle conditions.
configureClass ( string $class ) : Returns Configures a model class by setting the primary key to 'id', in keeping with CouchDb conventions.
create ( string $query, array $options = [] ) : boolean Create new document.
delete ( string $query, array $options = [] ) : boolean Delete document.
describe ( string $entity, array $schema = [], array $meta = [] ) : lithium\data\Schema Describe database, create if it does not exist.
enabled ( string $feature = null ) : boolean With no parameter, always returns true, since CouchDB only depends on HTTP. With a parameter, queries for a specific supported feature.
fields ( string $fields, string $context ) : array Fields for query.
item ( string $model, array $data = [], array $options = [] ) : object Returns a newly-created Document object, bound to a model and populated with default data and options.
limit ( string $limit, string $context ) : array Limit for query.
name ( string $name ) : string Quotes identifiers.
order ( string $order, string $context ) : array Order for query.
read ( string $query, array $options = [] ) : object Read from document.
respondsTo ( string $method, boolean $internal = false ) : boolean Determines if a given method can be called.
sources ( object $class = null ) : void Returns an array of object types accessible through this database.
update ( string $query, array $options = [] ) : boolean Update document.

Méthodes protégées

Méthode Description
_autoBuild ( string $result ) Helper used for auto building a CouchDB database.
_format ( array $data ) : array Formats a CouchDb result set into a standard result to be passed to item.
_init ( )

Method Details

__call() public méthode

Magic for passing methods to http service.
public __call ( string $method, array $params = [] ) : mixed
$method string
$params array
Résultat mixed

__construct() public méthode

Constructor.
public __construct ( array $config = [] ) : void
$config array Available configuration options are: - `'port'` _integer_ - `'version'` _integer_ - `'database'` _string_
Résultat void

__destruct() public méthode

Destructor. Ensures that the server connection is closed and resources are freed when the adapter instance is destroyed.
public __destruct ( ) : void
Résultat void

_autoBuild() protected méthode

Helper used for auto building a CouchDB database.
protected _autoBuild ( string $result )
$result string A query result.

_format() protected méthode

Formats a CouchDb result set into a standard result to be passed to item.
protected _format ( array $data ) : array
$data array data returned from query
Résultat array

_init() protected méthode

protected _init ( )

calculation() public méthode

Executes calculation-related queries, such as those required for count.
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.
Résultat integer Result of the calculation.

conditions() public méthode

Handle conditions.
public conditions ( string $conditions, string $context ) : array
$conditions string
$context string
Résultat array

configureClass() public méthode

Configures a model class by setting the primary key to 'id', in keeping with CouchDb conventions.
See also: lithium\data\Model::$_meta
See also: lithium\data\Model::$_classes
public configureClass ( string $class ) : Returns
$class string The fully-namespaced model class name to be configured.
Résultat Returns an array containing keys `'classes'` and `'meta'`, which will be merged with their respective properties in `Model`.

create() public méthode

Create new document.
public create ( string $query, array $options = [] ) : boolean
$query string
$options array
Résultat boolean

delete() public méthode

Delete document.
public delete ( string $query, array $options = [] ) : boolean
$query string
$options array
Résultat boolean

describe() public méthode

Describe database, create if it does not exist.
public describe ( string $entity, array $schema = [], array $meta = [] ) : lithium\data\Schema
$entity string
$schema array Any schema data pre-defined by the model.
$meta array
Résultat lithium\data\Schema

enabled() public static méthode

With no parameter, always returns true, since CouchDB only depends on HTTP. With a parameter, queries for a specific supported feature.
public static enabled ( string $feature = null ) : boolean
$feature string Test for support for a specific feature, i.e. `"transactions"` or `"arrays"`.
Résultat boolean Returns `true` if the particular feature support is enabled, otherwise `false`.

fields() public méthode

Fields for query.
public fields ( string $fields, string $context ) : array
$fields string
$context string
Résultat array

item() public méthode

Returns a newly-created Document object, bound to a model and populated with default data and options.
public item ( string $model, array $data = [], array $options = [] ) : object
$model string A fully-namespaced class name representing the model class to which the `Document` object will be bound.
$data array The default data with which the new `Document` should be populated.
$options array Any additional options to pass to the `Document`'s constructor
Résultat object Returns a new, un-saved `Document` object bound to the model class specified in `$model`.

limit() public méthode

Limit for query.
public limit ( string $limit, string $context ) : array
$limit string
$context string
Résultat array

name() public méthode

CouchDb does not need identifiers quoted, so this method simply returns the identifier.
public name ( string $name ) : string
$name string The identifier to quote.
Résultat string The quoted identifier.

order() public méthode

Order for query.
public order ( string $order, string $context ) : array
$order string
$context string
Résultat array

read() public méthode

Read from document.
public read ( string $query, array $options = [] ) : object
$query string
$options array
Résultat object

respondsTo() public méthode

Determines if a given method can be called.
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`.
Résultat boolean Returns `true` if the method can be called, `false` otherwise.

sources() public méthode

Returns an array of object types accessible through this database.
public sources ( object $class = null ) : void
$class object
Résultat void

update() public méthode

Update document.
public update ( string $query, array $options = [] ) : boolean
$query string
$options array
Résultat boolean

Property Details

$_classes protected_oe property

Classes used by CouchDb.
protected array $_classes
Résultat array

$_db protected_oe property

True if Database exists.
protected bool $_db
Résultat boolean

$_handlers protected_oe property

protected $_handlers

$_iterator protected_oe property

Increment value of current result set loop used by result to handle rows of json responses.
protected string $_iterator
Résultat string