function PdoTrait::fetchAsToPdo
Converts a FetchAs mode to a \PDO::FETCH_* constant value.
Parameters
\Drupal\Core\Database\FetchAs $mode: The FetchAs mode.
Return value
int A \PDO::FETCH_* constant value.
1 call to PdoTrait::fetchAsToPdo()
- StatementPrefetchIterator::setFetchMode in core/
lib/ Drupal/ Core/ Database/ StatementPrefetchIterator.php - Sets the default fetch mode for this statement.
File
-
core/
lib/ Drupal/ Core/ Database/ Statement/ PdoTrait.php, line 21
Class
- PdoTrait
- A trait for calling \PDOStatement methods.
Namespace
Drupal\Core\Database\StatementCode
protected function fetchAsToPdo(FetchAs $mode) : int {
return match ($mode) { FetchAs::Associative => \PDO::FETCH_ASSOC,
FetchAs::ClassObject => \PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE,
FetchAs::Column => \PDO::FETCH_COLUMN,
FetchAs::List => \PDO::FETCH_NUM,
FetchAs::Object => \PDO::FETCH_OBJ,
};
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.