This repository has been archived by the owner on Nov 21, 2019. It is now read-only.
forked from tyohan/MongoRecord
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'f/sinceBlocks' into devel
- Loading branch information
Showing
16 changed files
with
303 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,10 +29,14 @@ | |
* For operators list {@see EMongoCriteria::$operators} | ||
* | ||
* @author Dariusz Górecki <[email protected]> | ||
* | ||
* @since v1.0 | ||
*/ | ||
class EMongoCriteria extends CComponent | ||
{ | ||
/** | ||
* @since v1.0 | ||
* @var array $operators supported operators lists | ||
*/ | ||
public static $operators = array( | ||
'greater' => '$gt', | ||
'>' => '$gt', | ||
|
@@ -99,6 +103,7 @@ class EMongoCriteria extends CComponent | |
* ); | ||
* </PRE> | ||
* @param mixed $criteria | ||
* @since v1.0 | ||
*/ | ||
public function __construct($criteria=null) | ||
{ | ||
|
@@ -142,6 +147,7 @@ public function __construct($criteria=null) | |
* - Select fields list will be merged | ||
* - Sort fields list will be merged | ||
* @param array|EMongoCriteria $criteria | ||
* @since v1.0 | ||
*/ | ||
public function mergeWith($criteria) | ||
{ | ||
|
@@ -190,6 +196,7 @@ public function mergeWith($criteria) | |
/** | ||
* If we have operator add it otherwise call parent implementation | ||
* @see CComponent::__call() | ||
* @since v1.0 | ||
*/ | ||
public function __call($fieldName, $parameters) | ||
{ | ||
|
@@ -226,12 +233,18 @@ public function __call($fieldName, $parameters) | |
return parent::__call($fieldName, $parameters); | ||
} | ||
|
||
/** | ||
* @since v1.0.2 | ||
*/ | ||
public function __get($name) | ||
{ | ||
array_push($this->_workingFields, $name); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @since v1.0.2 | ||
*/ | ||
public function __set($name, $value) | ||
{ | ||
array_push($this->_workingFields, $name); | ||
|
@@ -243,42 +256,64 @@ public function __set($name, $value) | |
/** | ||
* Return query array | ||
* @return array query array | ||
* @since v1.0 | ||
*/ | ||
public function getConditions() | ||
{ | ||
return $this->_conditions; | ||
} | ||
|
||
/** | ||
* @since v1.0 | ||
*/ | ||
public function setConditions(array $conditions) | ||
{ | ||
$this->_conditions = $conditions; | ||
} | ||
|
||
/** | ||
* @since v1.0 | ||
*/ | ||
public function getLimit() | ||
{ | ||
return $this->_limit; | ||
} | ||
|
||
/** | ||
* @since v1.0 | ||
*/ | ||
public function setLimit($limit) | ||
{ | ||
$this->limit($limit); | ||
} | ||
|
||
/** | ||
* @since v1.0 | ||
*/ | ||
public function getOffset() | ||
{ | ||
return $this->_offset; | ||
} | ||
|
||
/** | ||
* @since v1.0 | ||
*/ | ||
public function setOffset($offset) | ||
{ | ||
$this->offset($offset); | ||
} | ||
|
||
/** | ||
* @since v1.0 | ||
*/ | ||
public function getSort() | ||
{ | ||
return $this->_sort; | ||
} | ||
|
||
/** | ||
* @since v1.0 | ||
*/ | ||
public function setSort(array $sort) | ||
{ | ||
$this->_sort = $sort; | ||
|
@@ -291,23 +326,33 @@ public function setSort(array $sort) | |
* the fields to be specified as a hashmap. When this | ||
* parameter is set to true, then we'll return | ||
* the fields in this format | ||
* @since v1.3.1 | ||
*/ | ||
public function getSelect($forCursor = false) | ||
{ | ||
if (!$forCursor) return $this->_select; | ||
return array_fill_keys($this->_select, true); // PHP 5.2.0+ required! | ||
} | ||
|
||
/** | ||
* @since v1.3.1 | ||
*/ | ||
public function setSelect(array $select) | ||
{ | ||
$this->_select = $select; | ||
} | ||
|
||
/** | ||
* @since v1.3.1 | ||
*/ | ||
public function getWorkingFields() | ||
{ | ||
return $this->_workingFields; | ||
} | ||
|
||
/** | ||
* @since v1.3.1 | ||
*/ | ||
public function setWorkingFields(array $select) | ||
{ | ||
$this->_workingFields = $select; | ||
|
@@ -318,6 +363,7 @@ public function setWorkingFields(array $select) | |
* Multiple calls to this method will merge all given fields | ||
* | ||
* @param array $fieldList list of fields to select | ||
* @since v1.0 | ||
*/ | ||
public function select(array $fieldList=null) | ||
{ | ||
|
@@ -331,6 +377,7 @@ public function select(array $fieldList=null) | |
* Multiple calls will overrride previous value of limit | ||
* | ||
* @param integer $limit limit | ||
* @since v1.0 | ||
*/ | ||
public function limit($limit) | ||
{ | ||
|
@@ -343,6 +390,7 @@ public function limit($limit) | |
* Multiple calls will override previous value | ||
* | ||
* @param integer $offset offset | ||
* @since v1.0 | ||
*/ | ||
public function offset($offset) | ||
{ | ||
|
@@ -355,6 +403,7 @@ public function offset($offset) | |
* Each call will be groupped with previous calls | ||
* @param string $fieldName | ||
* @param integer $order | ||
* @since v1.0 | ||
*/ | ||
public function sort($fieldName, $order) | ||
{ | ||
|
@@ -369,6 +418,7 @@ public function sort($fieldName, $order) | |
* @param string $fieldName | ||
* @param string $op operator | ||
* @param mixed $value | ||
* @since v1.0 | ||
*/ | ||
public function addCond($fieldName, $op, $value) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.