Skip to content

Commit

Permalink
Database\PostgresProcessor::processInserGettId | array cast fails to …
Browse files Browse the repository at this point in the history
…get "sequence" from entity when fetch mode is set to PDO::FETCH_CLASS (#14115)
  • Loading branch information
melloc01 authored and taylorotwell committed Jun 24, 2016
1 parent 9ed1a73 commit 6ad7db4
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ class PostgresProcessor extends Processor
*/
public function processInsertGetId(Builder $query, $sql, $values, $sequence = null)
{
$results = $query->getConnection()->selectFromWriteConnection($sql, $values);
$result = $query->getConnection()->selectFromWriteConnection($sql, $values)[0];

$sequence = $sequence ?: 'id';

$result = (array) $results[0];

$id = $result[$sequence];

$id = is_object($result) ? $result->$sequence : $result[$sequence];

return is_numeric($id) ? (int) $id : $id;
}

Expand Down

0 comments on commit 6ad7db4

Please sign in to comment.