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
13f009ec
Commit
13f009ec
authored
Jun 19, 2015
by
Mathieu Rochette
Committed by
Mathieu Rochette
Jun 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return result from Doctrine\DBAL\Connection::transactional()
parent
4ec16d06
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 @
13f009ec
...
@@ -1093,7 +1093,7 @@ class Connection implements DriverConnection
...
@@ -1093,7 +1093,7 @@ class Connection implements DriverConnection
*
*
* @param \Closure $func The function to execute transactionally.
* @param \Closure $func The function to execute transactionally.
*
*
* @return
void
* @return
mixed The value returned by $func
*
*
* @throws \Exception
* @throws \Exception
*/
*/
...
@@ -1101,8 +1101,9 @@ class Connection implements DriverConnection
...
@@ -1101,8 +1101,9 @@ class Connection implements DriverConnection
{
{
$this
->
beginTransaction
();
$this
->
beginTransaction
();
try
{
try
{
$func
(
$this
);
$
res
=
$
func
(
$this
);
$this
->
commit
();
$this
->
commit
();
return
$res
;
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
$this
->
rollBack
();
$this
->
rollBack
();
throw
$e
;
throw
$e
;
...
...
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
View file @
13f009ec
...
@@ -209,6 +209,14 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -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.
* 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