Maslosoft Mangan API
Class Criteria
Criteria
This class is a helper for building MongoDB query arrays, it support three syntaxes for adding conditions:
- 'equals' syntax: $criteriaObject->fieldName = $value; // this will produce fieldName == value query
- fieldName call syntax
$criteriaObject->fieldName($operator, $value); // this will produce fieldName
value - addCond method
$criteriaObject->addCond($fieldName, $operator, $vale); // this will produce fieldName
value
For operators list Criteria::$operators
- Maslosoft\Mangan\Criteria implements Maslosoft\Mangan\Interfaces\CriteriaInterface, Maslosoft\Mangan\Interfaces\ModelAwareInterface uses Maslosoft\Mangan\Traits\Criteria\CursorAwareTrait, Maslosoft\Mangan\Traits\Criteria\DecoratableTrait, Maslosoft\Mangan\Traits\Criteria\LimitableTrait, Maslosoft\Mangan\Traits\ModelAwareTrait, Maslosoft\Mangan\Traits\Criteria\SelectableTrait, Maslosoft\Mangan\Traits\Criteria\SortableTrait
Author: Ianaré Sévi
Author: Dariusz Górecki darek.krk@gmail.com
Author: Invenzzia Group, open-source division of CleverIT company http://www.invenzzia.org
Copyright: 2011 CleverIT http://www.cleverit.com.pl
License: BSD license
Located at Criteria.php
Methods summary
public
|
#
__construct( mixed|
Constructor Example criteria: |
public
|
#
mergeWith( null|array|
Merge with other criteria - Field list operators will be merged - Limit and offet will be overriden - Select fields list will be merged - Sort fields list will be merged |
public
|
|
public
|
|
public
|
|
public
array
|
|
public
|
|
public
|
Methods inherited from Maslosoft\Mangan\Interfaces\Criteria\SortableInterface
Methods inherited from Maslosoft\Mangan\Interfaces\Criteria\SelectableInterface
Methods inherited from Maslosoft\Mangan\Interfaces\Criteria\LimitableInterface
getLimit(),
getOffset(),
limit(),
offset(),
setLimit(),
setOffset()
Methods inherited from Maslosoft\Mangan\Interfaces\Criteria\DecoratableInterface
Methods inherited from Maslosoft\Mangan\Interfaces\Criteria\CursorAwareInterface
Methods inherited from Maslosoft\Mangan\Interfaces\ModelAwareInterface
Methods used from Maslosoft\Mangan\Traits\Criteria\CursorAwareTrait
Methods used from Maslosoft\Mangan\Traits\Criteria\DecoratableTrait
Methods used from Maslosoft\Mangan\Traits\Criteria\LimitableTrait
getLimit(),
getOffset(),
limit(),
offset(),
setLimit(),
setOffset()
Methods used from Maslosoft\Mangan\Traits\ModelAwareTrait
Methods used from Maslosoft\Mangan\Traits\Criteria\SelectableTrait
Methods used from Maslosoft\Mangan\Traits\Criteria\SortableTrait
Constants summary
string |
SortAsc
Sort Ascending |
#
Maslosoft\Mangan\SortInterface::SortAsc
|
string |
SortDesc
Sort Descending |
#
Maslosoft\Mangan\SortInterface::SortDesc
|
string |
SORT_ASC
Sort Ascending |
#
Maslosoft\Mangan\SortInterface::SortAsc
|
string |
SORT_DESC
Sort Descending |
#
Maslosoft\Mangan\SortInterface::SortDesc
|
Properties summary
public static
array
|
$operators
$operators supported operators lists |
#
[
// Comparison
// Matches values that are equal to a specified value.
'eq' => '$eq',
'equals' => '$eq',
'==' => '$eq',
// Matches values that are greater than a specified value.
'gt' => '$gt',
'greater' => '$gt',
'>' => '$gt',
// Matches values that are greater than or equal to a specified value.
'gte' => '$gte',
'greatereq' => '$gte',
'>=' => '$gte',
// Matches values that are less than a specified value.
'lt' => '$lt',
'less' => '$lt',
'<' => '$lt',
// Matches values that are less than or equal to a specified value.
'lte' => '$lte',
'lesseq' => '$lte',
'<=' => '$lte',
// Matches all values that are not equal to a specified value.
'ne' => '$ne',
'noteq' => '$ne',
'!=' => '$ne',
'<>' => '$ne',
// Matches any of the values specified in an array.
'in' => '$in',
// Matches none of the values specified in an array.
'notin' => '$nin',
// Logical
// Joins query clauses with a logical OR returns all documents that match the conditions of either clause.
'or' => '$or',
// Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
'and' => '$and',
// Inverts the effect of a query expression and returns documents that do not match the query expression.
'not' => '$not',
// Joins query clauses with a logical NOR returns all documents that fail to match both clauses.
'nor' => '$nor',
// Element
// Matches documents that have the specified field.
'exists' => '$exists',
'notexists' => '$exists',
// Selects documents if a field is of the specified type.
'type' => '$type',
// Evaluation
// Performs a modulo operation on the value of a field and selects documents with a specified result.
'mod' => '$mod',
'%' => '$mod',
// Selects documents where values match a specified regular expression.
'regex' => '$regex',
// Performs text search.
'text' => '$text',
// Matches documents that satisfy a JavaScript expression.
'where' => '$where',
// Geospatial
// Selects geometries within a bounding GeoJSON geometry. The `2dsphere` and `2d` indexes support $geoWithin.
'geoWithin' => '$geoWithin',
// Selects geometries that intersect with a GeoJSON geometry. The `2dsphere` index supports $geoIntersects.
'geoIntersects' => '$geoIntersects',
// Returns geospatial objects in proximity to a point. Requires a geospatial index. The `2dsphere` and `2d` indexes support $near.
'near' => '$near',
// Returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The `2dsphere` and `2d` indexes support $nearSphere.
'nearSphere' => '$nearSphere',
// Array
// Matches arrays that contain all elements specified in the query.
'all' => '$all',
// Selects documents if element in the array field matches all the specified $elemMatch conditions.
'elemmatch' => '$elemMatch',
// Selects documents if the array field is a specified size.
'size' => '$size',
// Comments
'comment' => '$comment'
]
|