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
9ecfda6e
Commit
9ecfda6e
authored
Jun 29, 2017
by
Marco Pivetta
Committed by
GitHub
Jun 29, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2760 from dsantang/document-retryable-transactional-errors
Add documentation regarding transactional exceptions
parents
bd9bd010
7b4479b2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
transactions.rst
docs/en/reference/transactions.rst
+29
-0
No files found.
docs/en/reference/transactions.rst
View file @
9ecfda6e
...
...
@@ -235,3 +235,32 @@ To initialize a ``Doctrine\DBAL\Connection`` with auto-commit disabled,
you can also use the ``Doctrine\DBAL\Configuration`` container to modify the
default auto-commit mode via ``Doctrine\DBAL\Configuration::setAutoCommit(false)``
and pass it to a ``Doctrine\DBAL\Connection`` when instantiating.
Error handling
--------------
In order to handle errors related to deadlocks or lock wait timeouts,
you can use Doctrine built-in transaction exceptions.
All transaction exceptions have a marker interface: ``Doctrine/DBAL/Exception/RetryableException``.
A practical example is as follows:
::
<?php
try {
// process stuff
} catch (\Doctrine/DBAL/Exception/RetryableException $e) {
// retry the processing
}
If you need stricter control, you can catch the concrete exceptions directly:
- ``Doctrine/DBAL/Exception/DeadlockException``: this can happen when each member
of a group of actions is waiting for some other member to release a shared lock.
- ``Doctrine/DBAL/Exception/LockWaitTimeoutException``: this exception happens when
a transaction have to wait a considerable amount of time to obtain a lock, even if a deadlock
is not involved.
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