Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/Persistence/Legacy/TransactionHandler.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Persistence\Legacy;
8
9 use eZ\Publish\SPI\Persistence\TransactionHandler as TransactionHandlerInterface;
10 use eZ\Publish\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler as CachingContentTypeHandler;
11 use eZ\Publish\Core\Persistence\Legacy\Content\Language\CachingHandler as CachingLanguageHandler;
12 use eZ\Publish\Core\Persistence\Database\DatabaseHandler;
13 use Exception;
14 use RuntimeException;
15
21 class TransactionHandler implements TransactionHandlerInterface
22 {
28 protected $dbHandler;
29
31 protected $contentTypeHandler;
32
34 protected $languageHandler;
35
41 public function __construct(
42 DatabaseHandler $dbHandler,
43 CachingContentTypeHandler $contentTypeHandler = null,
44 CachingLanguageHandler $languageHandler = null
45 ) {
46 $this->dbHandler = $dbHandler;
47 $this->contentTypeHandler = $contentTypeHandler;
48 $this->languageHandler = $languageHandler;
49 }
50
54 public function beginTransaction()
55 {
56 $this->dbHandler->beginTransaction();
57 }
58
66 public function commit()
67 {
68 try {
69 $this->dbHandler->commit();
70 } catch (Exception $e) {
71 throw new RuntimeException($e->getMessage(), 0, $e);
72 }
73 }
74
82 public function rollback()
83 {
84 try {
85 $this->dbHandler->rollback();
86
87 // Clear all caches after rollback
88 if ($this->contentTypeHandler instanceof CachingContentTypeHandler) {
89 $this->contentTypeHandler->clearCache();
90 }
91
92 if ($this->languageHandler instanceof CachingLanguageHandler) {
93 $this->languageHandler->clearCache();
94 }
95 } catch (Exception $e) {
96 throw new RuntimeException($e->getMessage(), 0, $e);
97 }
98 }
99 }
eZ\Publish\Core\Persistence\Legacy\Content\Language\CachingHandler
Language Handler.
Definition: CachingHandler.php:19
eZ\Publish\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler
Definition: MemoryCachingHandler.php:20
eZ\Publish\Core\Persistence\Legacy\TransactionHandler
The Transaction handler for Legacy Storage Engine.
Definition: Core/Persistence/Legacy/TransactionHandler.php:22
eZ\Publish\Core\Persistence\Legacy\TransactionHandler\rollback
rollback()
Rollback transaction.
Definition: Core/Persistence/Legacy/TransactionHandler.php:82
eZ\Publish\Core\Persistence\Legacy\TransactionHandler\$contentTypeHandler
$contentTypeHandler
Definition: Core/Persistence/Legacy/TransactionHandler.php:31
eZ\Publish\Core\Persistence\Legacy\TransactionHandler\__construct
__construct(DatabaseHandler $dbHandler, CachingContentTypeHandler $contentTypeHandler=null, CachingLanguageHandler $languageHandler=null)
Definition: Core/Persistence/Legacy/TransactionHandler.php:41
eZ\Publish\Core\Persistence\Legacy\TransactionHandler\commit
commit()
Commit transaction.
Definition: Core/Persistence/Legacy/TransactionHandler.php:66
eZ\Publish\Core\Persistence\Legacy\TransactionHandler\$languageHandler
$languageHandler
Definition: Core/Persistence/Legacy/TransactionHandler.php:34
eZ\Publish\Core\Persistence\Legacy\TransactionHandler\$dbHandler
$dbHandler
Definition: Core/Persistence/Legacy/TransactionHandler.php:28
eZ\Publish\Core\Persistence\Legacy\TransactionHandler\beginTransaction
beginTransaction()
Begin transaction.
Definition: Core/Persistence/Legacy/TransactionHandler.php:54
eZ\Publish\Core\Persistence\Database\DatabaseHandler
Interface for relational database abstractions supported by eZ.
Definition: DatabaseHandler.php:18
eZ\Publish\SPI\Persistence\TransactionHandler
The Persistence Transaction handler for Storage Engine.
Definition: SPI/Persistence/TransactionHandler.php:15
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.