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
eae7b0d8
Commit
eae7b0d8
authored
Jul 15, 2015
by
Bill Schaller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #872 from mathroc/feature/transactional
return result from Doctrine\DBAL\Connection::transactional()
parents
03a76929
13f009ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
Connection.php
lib/Doctrine/DBAL/Connection.php
+3
-2
ConnectionTest.php
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
+8
-0
No files found.
lib/Doctrine/DBAL/Connection.php
View file @
eae7b0d8
...
...
@@ -1093,7 +1093,7 @@ class Connection implements DriverConnection
*
* @param \Closure $func The function to execute transactionally.
*
* @return
void
* @return
mixed The value returned by $func
*
* @throws \Exception
*/
...
...
@@ -1101,8 +1101,9 @@ class Connection implements DriverConnection
{
$this
->
beginTransaction
();
try
{
$func
(
$this
);
$
res
=
$
func
(
$this
);
$this
->
commit
();
return
$res
;
}
catch
(
Exception
$e
)
{
$this
->
rollBack
();
throw
$e
;
...
...
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
View file @
eae7b0d8
...
...
@@ -209,6 +209,14 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
});
}
public
function
testTransactionalReturnValue
()
{
$res
=
$this
->
_conn
->
transactional
(
function
(
$conn
)
{
return
42
;
});
$this
->
assertEquals
(
42
,
$res
);
}
/**
* Tests that the quote function accepts DBAL and PDO types.
*/
...
...
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