Skip to content

Commit

Permalink
Merge pull request #49 from ikkez/mapper-type-hint
Browse files Browse the repository at this point in the history
Improved mapper & collection type hints
  • Loading branch information
bcosca committed Apr 20, 2015
2 parents 19cdc20 + e510e1f commit 5ecb68f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion db/cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function dry() {

/**
* Return first record (mapper object) that matches criteria
* @return object|FALSE
* @return \DB\Cursor|FALSE
* @param $filter string|array
* @param $options array
* @param $ttl int
Expand Down
2 changes: 1 addition & 1 deletion db/jig/mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function($expr) use($self) {

/**
* Return records that match criteria
* @return array|FALSE
* @return \DB\JIG\Mapper[]|FALSE
* @param $filter array
* @param $options array
* @param $ttl int
Expand Down
6 changes: 3 additions & 3 deletions db/mongo/mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function clear($key) {

/**
* Convert array to mapper object
* @return object
* @return \DB\Mongo\Mapper
* @param $row array
**/
protected function factory($row) {
Expand All @@ -111,7 +111,7 @@ function cast($obj=NULL) {

/**
* Build query and execute
* @return array
* @return \DB\Mongo\Mapper[]
* @param $fields string
* @param $filter array
* @param $options array
Expand Down Expand Up @@ -177,7 +177,7 @@ function select($fields=NULL,$filter=NULL,array $options=NULL,$ttl=0) {

/**
* Return records that match criteria
* @return array
* @return \DB\Mongo\Mapper[]
* @param $filter array
* @param $options array
* @param $ttl int
Expand Down
7 changes: 4 additions & 3 deletions db/sql/mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ function set($key,$val) {
$this->fields[$key]['changed']=TRUE;
return $this->fields[$key]['value']=$val;
}
// Parenthesize expression in case it's a subquery
// adjust result on existing expressions
if (isset($this->adhoc[$key]))
$this->adhoc[$key]['value']=$val;
else
// Parenthesize expression in case it's a subquery
$this->adhoc[$key]=array('expr'=>'('.$val.')','value'=>NULL);
return $val;
}
Expand Down Expand Up @@ -194,7 +195,7 @@ function($row) {

/**
* Build query string and execute
* @return array
* @return \DB\SQL\Mapper[]
* @param $fields string
* @param $filter string|array
* @param $options array
Expand Down Expand Up @@ -298,7 +299,7 @@ function($str) use($db) {

/**
* Return records that match criteria
* @return array
* @return \DB\SQL\Mapper[]
* @param $filter string|array
* @param $options array
* @param $ttl int
Expand Down

0 comments on commit 5ecb68f

Please sign in to comment.