Skip to content

Commit

Permalink
it was decided to remove the $mappers argument because mappers are mo…
Browse files Browse the repository at this point in the history
…re elegantly supported by the Mappers trait and MapperProvider interface; closes #20
  • Loading branch information
Rasmus Schultz committed Jun 21, 2016
1 parent 0232ede commit 79699f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/framework/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,16 @@ interface Connection
/**
* Fetch the `Result` of executing an SQL "SELECT" statement.
*
* If the given `Executable` implements `MapperProvider`, any Mappers provided by it will
* be prepended to the given list of Mappers.
*
* Note that you can directly iterate over the `Result` instance.
*
* @see MapperProvider optional interface enabling an Executable to provide Mappers
*
* @param Statement $statement
* @param int $batch_size batch-size (when fetching large result sets)
* @param Mapper[] $mappers list of additional Mappers to apply while fetching results
*
* @return Result
*
* @see MapperProvider optional interface enabling an Executable to provide Mappers
*/
public function fetch(Statement $statement, $batch_size = 1000, array $mappers = []);
public function fetch(Statement $statement, $batch_size = 1000);

/**
* Execute an SQL statement, which does not produce a result, e.g. an "INSERT", "UPDATE" or "DELETE" statement.
Expand Down
9 changes: 4 additions & 5 deletions src/framework/pdo/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ public function prepare(Statement $statement)
/**
* @inheritdoc
*/
public function fetch(Statement $statement, $batch_size = 1000, array $mappers = [])
public function fetch(Statement $statement, $batch_size = 1000)
{
if ($statement instanceof MapperProvider) {
// prepend Mappers provided by the Executable:
$mappers = array_merge($statement->getMappers(), $mappers);
}
$mappers = $statement instanceof MapperProvider
? $statement->getMappers()
: [];

return new Result(
$this->prepare($statement),
Expand Down

0 comments on commit 79699f6

Please sign in to comment.