$mCursor
$mCursor : \OntologyWrapper\Iterator
Cursor.
This data member holds the query cursor.
Mongo iterator object
This concrete class derived from {@link ObjectIterator} implements a query iterator which uses a {@link MongoCursor} instance as the object cursor.
$mCollection : \OntologyWrapper\CollectionObject
Collection.
This data member holds the collection.
$mResultType : \OntologyWrapper\bitfield
Result.
This data member holds an enumerated value determining what the iterator should return:
__construct(\OntologyWrapper\Iterator $theCursor, \OntologyWrapper\CollectionObject $theCollection, array $theCriteria, array $theFields, mixed $theKey, \OntologyWrapper\bitfield $theResult)
Instantiate class.
The constructor expects the following parameters:
\OntologyWrapper\Iterator | $theCursor | Query cursor. |
\OntologyWrapper\CollectionObject | $theCollection | Query collection. |
array | $theCriteria | Query criteria. |
array | $theFields | Query fields. |
mixed | $theKey | Iterator key. |
\OntologyWrapper\bitfield | $theResult | Result type. |
affectedCount() : int
<h4>Return affected count</h4>
Return the total count excluding eventual limits and skip.
Note that the cursor must implement the Countable interface in which the count() method should return the count including skip and limits.
Element count excluding skip and limits.
skip(integer $theCount) : integer
<h4>Skip a number of elements</h4>
This method can be used to skip a number of records, if you provide an integer, the iterator will start from the element corresponding to the provided value; in this case the method should be used only before the cursor has beed iterated.
If you provide NULL, the method should return the current skip value.
The method will return the current skip value.
integer | $theCount | Number of elements to skip. |
Current skip value.
limit(integer $theCount) : integer
<h4>Limit the number of elements</h4>
This method can be used to provide the maximum number of records to be returned, if you provide an integer, the iterator will limit its results to the number corresponding to the provided value; in this case the method should be used only before the cursor has beed iterated.
If you provide NULL, the method should return the current limit value.
The method will return the current limit value.
integer | $theCount | Maximum number of iterations. |
Current limit value.
fields(array $theFields) : array
<h4>Select the fields to be returned</h4>
This method should be used only before the cursor has beed iterated, it will indicate which fields the cursor should return according to the provided array parameter:
If the cursor has already started iterating, the method should raise an exception.
If you provide NULL, the method will return the current fields selection.
The method will return the current fields selection.
array | $theFields | Fields selection. |
Current fields selection.
sort(array $theOrder) : array
<h4>Sort the cursor</h4>
This method should be used only before the cursor has beed iterated, it will sort the cursor elements according to the provided array parameter:
The sort is also determined by the order in which the array elements are provided.
If the cursor has already started iterating, the method should raise an exception.
array | $theOrder | Sort order indications. |
Current sort order.
setTimeout(int $theTimeout)
<h4>Set cursor timeout</h4>
This method should be used to set the cursor timeout, the method should be available also once the cursor has been iterated.
The method accepts a single parameter indicating the timeout in milliseconds.
int | $theTimeout | Timeout in milliseconds. |
collection() : \OntologyWrapper\CollectionObject
<h4>Return collection</h4>
This method can be used to retrieve the current object's collection, which is the collection object that was queried.
Query collection.
resultType(mixed $theValue, boolean $getOld) : mixed
Manage result type
This method can be used to manage the result type, it accepts a parameter which represents either the result type code or the requested operation, depending on its value:
The second parameter is a boolean which if TRUE will return the old value when replacing or resetting; if FALSE, it will return the current value.
mixed | $theValue | Data source name or operation. |
boolean | $getOld | TRUE get old value. |
New or old result type code.
shapeResult(array $theObject) : mixed
Cast iterator value
This method will format the provided cursor value according to the {@link resultType()}.
Depending on the {@link resultType()} value:
The method expects the value provided as an array.
array | $theObject | Current cursor value. |
The formatted value.