Skip to content

Conversation

vlakoff
Copy link
Contributor

@vlakoff vlakoff commented Jun 18, 2016

PDO fetch style FETCH_CLASS is expected to be used along a class name.


It currently works in Laravel because the latter does the following, which happens to work only by chance:

$results = $stmt->fetchAll(PDO::FETCH_CLASS);


However, the following would produce an error:

$stmt->setFetchMode(PDO::FETCH_CLASS);
$results = $stmt->fetchAll();

PDOStatement::setFetchMode(): SQLSTATE[HY000]: General error: fetch mode requires the classname argument


This PR switches to the proper fetch style, which is robuster, and even more importantly, less confusing for the user. It's fully backward compatible.


Refs:

@GrahamCampbell
Copy link
Member

Thanks. Probably best to do this on develop.

vlakoff referenced this pull request in laravel/framework Jun 18, 2016
@taylorotwell
Copy link
Member

Yeah can we go ahead and send this to 5.3 when you get a chance just to be safe? Thanks

@GrahamCampbell
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants