Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
b568ff01
Commit
b568ff01
authored
5 months ago
by
mondrake
Browse files
Options
Downloads
Patches
Plain Diff
fix PdoTrait PHPDocs
parent
f06bf6c0
No related branches found
No related tags found
4 merge requests
!11355
Create the database driver for MySQLi #3259709
,
!10263
Closes #3488467
,
!10207
Replace \PDO::FETCH_* constants to indicate fetch mode with an enumeration
,
!5247
Enable dynamic queries to produce SQL with positional placeholders
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/lib/Drupal/Core/Database/Statement/PdoTrait.php
+19
-1
19 additions, 1 deletion
core/lib/Drupal/Core/Database/Statement/PdoTrait.php
with
19 additions
and
1 deletion
core/lib/Drupal/Core/Database/Statement/PdoTrait.php
+
19
−
1
View file @
b568ff01
...
...
@@ -9,6 +9,15 @@
*/
trait
PdoTrait
{
/**
* Converts a FetchAs mode to a \PDO::FETCH_* constant value.
*
* @param \Drupal\Core\Database\FetchAs $mode
* The FetchAs mode.
*
* @return int
* A \PDO::FETCH_* constant value.
*/
protected
function
fetchAsToPdo
(
FetchAs
$mode
):
int
{
return
match
(
$mode
)
{
FetchAs
::
Associative
=>
\PDO
::
FETCH_ASSOC
,
...
...
@@ -19,6 +28,15 @@ protected function fetchAsToPdo(FetchAs $mode): int {
};
}
/**
* Converts a \PDO::FETCH_* constant value to a FetchAs mode.
*
* @param int $mode
* The \PDO::FETCH_* constant value.
*
* @return \Drupal\Core\Database\FetchAs
* A FetchAs mode.
*/
protected
function
pdoToFetchAs
(
int
$mode
):
FetchAs
{
return
match
(
$mode
)
{
\PDO
::
FETCH_ASSOC
=>
FetchAs
::
Associative
,
...
...
@@ -170,7 +188,7 @@ protected function clientFetchObject(?string $class = NULL, array $constructorAr
* @return array<array<scalar|null>|object|scalar|null>
* An array of results.
*/
// phpcs:ignore Drupal.Commenting.FunctionComment.InvalidReturn
// phpcs:ignore Drupal.Commenting.FunctionComment.InvalidReturn
, Drupal.Commenting.FunctionComment.Missing
protected
function
clientFetchAll
(
?FetchAs
$mode
=
NULL
,
int
|
string
|
null
$columnOrClass
=
NULL
,
array
|
null
$constructorArguments
=
NULL
):
array
{
return
match
(
$mode
)
{
FetchAs
::
Column
=>
$this
->
getClientStatement
()
->
fetchAll
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment