Skip to content
Snippets Groups Projects
Commit d9e7191f authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #310904 by mfer, Crell et al: use early fetch and document why.

parent 3257718a
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -1047,8 +1047,10 @@ protected function __construct($dbh) {
public function execute($args, $options) {
if (isset($options['fetch'])) {
if (is_string($options['fetch'])) {
// PDO::FETCH_PROPS_LATE tells __construct() to run before properties are added to the object.
$this->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, $options['fetch']);
// Default to an object. Note: db fields will be added to the object
// before the constructor is run. If you need to assign fields after
// the constructor is run, see http://drupal.org/node/315092.
$this->setFetchMode(PDO::FETCH_CLASS, $options['fetch']);
}
else {
$this->setFetchMode($options['fetch']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment