Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
24cefe5d
Commit
24cefe5d
authored
Mar 10, 2020
by
Craig Duncan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure the constructor arguments are passed to custom classes
parent
9e880d97
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
Statement.php
lib/Doctrine/DBAL/Statement.php
+1
-5
StatementTest.php
tests/Doctrine/Tests/DBAL/StatementTest.php
+13
-1
No files found.
lib/Doctrine/DBAL/Statement.php
View file @
24cefe5d
...
...
@@ -249,11 +249,7 @@ class Statement implements IteratorAggregate, DriverStatement
*/
public
function
fetchAll
(
$fetchMode
=
null
,
$fetchArgument
=
null
,
$ctorArgs
=
null
)
{
if
(
$fetchArgument
)
{
return
$this
->
stmt
->
fetchAll
(
$fetchMode
,
$fetchArgument
);
}
return
$this
->
stmt
->
fetchAll
(
$fetchMode
);
return
$this
->
stmt
->
fetchAll
(
$fetchMode
,
$fetchArgument
,
$ctorArgs
);
}
/**
...
...
tests/Doctrine/Tests/DBAL/StatementTest.php
View file @
24cefe5d
...
...
@@ -7,6 +7,7 @@ use Doctrine\DBAL\Connection;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\Driver
;
use
Doctrine\DBAL\Driver\Connection
as
DriverConnection
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\Logging\SQLLogger
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Statement
;
...
...
@@ -28,7 +29,7 @@ class StatementTest extends DbalTestCase
protected
function
setUp
()
:
void
{
$this
->
pdoStatement
=
$this
->
getMockBuilder
(
PDOStatement
::
class
)
->
onlyMethods
([
'execute'
,
'bindParam'
,
'bindValue'
])
->
onlyMethods
([
'execute'
,
'bindParam'
,
'bindValue'
,
'fetchAll'
])
->
getMock
();
$driverConnection
=
$this
->
createMock
(
DriverConnection
::
class
);
...
...
@@ -150,4 +151,15 @@ class StatementTest extends DbalTestCase
$statement
->
execute
();
}
public
function
testPDOCustomClassConstructorArgs
()
:
void
{
$statement
=
new
Statement
(
''
,
$this
->
conn
);
$this
->
pdoStatement
->
expects
(
$this
->
once
())
->
method
(
'fetchAll'
)
->
with
(
self
::
equalTo
(
FetchMode
::
CUSTOM_OBJECT
),
self
::
equalTo
(
'Example'
),
self
::
equalTo
([
'arg1'
]));
$statement
->
fetchAll
(
FetchMode
::
CUSTOM_OBJECT
,
'Example'
,
[
'arg1'
]);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment