|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | namespace Enqueue\JobQueue\Test;
|
3 | 4 |
|
4 | 5 | use Doctrine\DBAL\Connection;
|
@@ -65,40 +66,6 @@ public function rollBack()
|
65 | 66 | $this->wrapTransactionNestingLevel('rollBack');
|
66 | 67 | }
|
67 | 68 |
|
68 |
| - /** |
69 |
| - * @param int $level |
70 |
| - */ |
71 |
| - private function setTransactionNestingLevel($level) |
72 |
| - { |
73 |
| - $prop = new \ReflectionProperty('Doctrine\DBAL\Connection', '_transactionNestingLevel'); |
74 |
| - $prop->setAccessible(true); |
75 |
| - |
76 |
| - return $prop->setValue($this, $level); |
77 |
| - } |
78 |
| - |
79 |
| - /** |
80 |
| - * @param string $method |
81 |
| - * |
82 |
| - * @throws \Exception |
83 |
| - */ |
84 |
| - private function wrapTransactionNestingLevel($method) |
85 |
| - { |
86 |
| - $e = null; |
87 |
| - |
88 |
| - $this->setTransactionNestingLevel($this->getPersistedTransactionNestingLevel()); |
89 |
| - |
90 |
| - try { |
91 |
| - call_user_func(['parent', $method]); |
92 |
| - } catch (\Exception $e) { |
93 |
| - } |
94 |
| - |
95 |
| - $this->persistTransactionNestingLevel($this->getTransactionNestingLevel()); |
96 |
| - |
97 |
| - if ($e) { |
98 |
| - throw $e; |
99 |
| - } |
100 |
| - } |
101 |
| - |
102 | 69 | /**
|
103 | 70 | * @param bool $connected
|
104 | 71 | */
|
@@ -161,4 +128,38 @@ protected function getConnectionId()
|
161 | 128 | {
|
162 | 129 | return md5(serialize($this->getParams()));
|
163 | 130 | }
|
| 131 | + |
| 132 | + /** |
| 133 | + * @param int $level |
| 134 | + */ |
| 135 | + private function setTransactionNestingLevel($level) |
| 136 | + { |
| 137 | + $prop = new \ReflectionProperty('Doctrine\DBAL\Connection', '_transactionNestingLevel'); |
| 138 | + $prop->setAccessible(true); |
| 139 | + |
| 140 | + return $prop->setValue($this, $level); |
| 141 | + } |
| 142 | + |
| 143 | + /** |
| 144 | + * @param string $method |
| 145 | + * |
| 146 | + * @throws \Exception |
| 147 | + */ |
| 148 | + private function wrapTransactionNestingLevel($method) |
| 149 | + { |
| 150 | + $e = null; |
| 151 | + |
| 152 | + $this->setTransactionNestingLevel($this->getPersistedTransactionNestingLevel()); |
| 153 | + |
| 154 | + try { |
| 155 | + call_user_func(['parent', $method]); |
| 156 | + } catch (\Exception $e) { |
| 157 | + } |
| 158 | + |
| 159 | + $this->persistTransactionNestingLevel($this->getTransactionNestingLevel()); |
| 160 | + |
| 161 | + if ($e) { |
| 162 | + throw $e; |
| 163 | + } |
| 164 | + } |
164 | 165 | }
|
0 commit comments