Skip to content

Commit

Permalink
Fix docblock.
Browse files Browse the repository at this point in the history
Formatter callbacks don't receive query as argument.
  • Loading branch information
ADmad committed Apr 7, 2015
1 parent 7aa78fd commit f3fe4a6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Datasource/QueryTrait.php
Expand Up @@ -270,8 +270,7 @@ public function mapReduce(callable $mapper = null, callable $reducer = null, $ov
* to fetch the results from the database.
*
* Formatting callbacks will get a first parameter, a `ResultSetDecorator`, that
* can be traversed and modified at will. As for the second parameter, the
* formatting callback will receive this query instance.
* can be traversed and modified at will.
*
* Callbacks are required to return an iterator object, which will be used as
* the return value for this query's result. Formatter functions are applied
Expand All @@ -287,12 +286,12 @@ public function mapReduce(callable $mapper = null, callable $reducer = null, $ov
*
* ```
* // Return all results from the table indexed by id
* $query->select(['id', 'name'])->formatResults(function ($results, $query) {
* $query->select(['id', 'name'])->formatResults(function ($results) {
* return $results->indexBy('id');
* });
*
* // Add a new column to the ResultSet
* $query->select(['name', 'birth_date'])->formatResults(function ($results, $query) {
* $query->select(['name', 'birth_date'])->formatResults(function ($results) {
* return $results->map(function ($row) {
* $row['age'] = $row['birth_date']->diff(new DateTime)->y;
* return $row;
Expand Down

0 comments on commit f3fe4a6

Please sign in to comment.