Details
Description
When doing transactional multi table update using DQL query the changes are not rolled back after exception is raised after the update.
$em->transactional(function($entityManager) {
$dql = "UPDATE ..."; // some multi table update DQL
$query = $entityManager->createQuery($dql);
$query->execute();
throw new Exception();
});
This is because Doctrine executes "DROP TABLE" for temporary table created for the update but MySQL is doing commit right after DROP and CREATE statements automatically.
From PHP documentation:
"Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit COMMIT will prevent you from rolling back any other changes within the transaction boundary."
Activity
Benjamin Eberlei
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 2.1.2 [ 10154 ] | |
| Resolution | Fixed [ 1 ] |
Benjamin Eberlei
made changes -
| Workflow | jira [ 12932 ] | jira-feedback [ 15000 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback [ 15000 ] | jira-feedback2 [ 16864 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback2 [ 16864 ] | jira-feedback3 [ 19117 ] |
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1337, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
I have done temporary workaround just by commenting out the line
165: $conn->executeUpdate($this->_dropTempTableSql);from class Doctrine\ORM\Query\Exec\MultiTableUpdateExecutor.
I guess it is not correct solution for all platforms, is it?