Skip to content

Commit

Permalink
dont return from generator method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 24, 2016
1 parent ea0ce4a commit e8cb617
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public function select($query, $bindings = [], $useReadPdo = true)
*/
public function cursor($query, $bindings = [], $useReadPdo = true)
{
return $this->run($query, $bindings, function ($me, $query, $bindings) use ($useReadPdo) {
$statement = $this->run($query, $bindings, function ($me, $query, $bindings) use ($useReadPdo) {
if ($me->pretending()) {
return [];
}
Expand All @@ -367,10 +367,12 @@ public function cursor($query, $bindings = [], $useReadPdo = true)

$statement->execute($me->prepareBindings($bindings));

while ($record = $statement->fetch()) {
yield $record;
}
return $statement;
});

while ($record = $statement->fetch()) {
yield $record;
}
}

/**
Expand Down

0 comments on commit e8cb617

Please sign in to comment.