1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
5
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
namespace eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway; |
8
|
|
|
|
9
|
|
|
use eZ\Publish\Core\Base\Exceptions\DatabaseException; |
10
|
|
|
use eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway; |
11
|
|
|
use Doctrine\DBAL\DBALException; |
12
|
|
|
use PDOException; |
13
|
|
|
|
14
|
|
|
class ExceptionConversion extends Gateway |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* The wrapped gateway. |
18
|
|
|
* |
19
|
|
|
* @var \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway |
20
|
|
|
*/ |
21
|
|
|
protected $innerGateway; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Creates a new exception conversion gateway around $innerGateway. |
25
|
|
|
* |
26
|
|
|
* @param \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway $innerGateway |
27
|
|
|
*/ |
28
|
|
|
public function __construct(Gateway $innerGateway) |
29
|
|
|
{ |
30
|
|
|
$this->innerGateway = $innerGateway; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function setTable($name) |
34
|
|
|
{ |
35
|
|
|
try { |
36
|
|
|
return $this->innerGateway->setTable($name); |
37
|
|
|
} catch (DBALException | PDOException $e) { |
38
|
|
|
throw DatabaseException::wrap($e); |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function loadLocationEntries($locationId, $custom = false, $languageId = false) |
43
|
|
|
{ |
44
|
|
|
try { |
45
|
|
|
return $this->innerGateway->loadLocationEntries($locationId, $custom); |
46
|
|
|
} catch (DBALException | PDOException $e) { |
47
|
|
|
throw DatabaseException::wrap($e); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function isRootEntry($id) |
52
|
|
|
{ |
53
|
|
|
try { |
54
|
|
|
return $this->innerGateway->isRootEntry($id); |
55
|
|
|
} catch (DBALException | PDOException $e) { |
56
|
|
|
throw DatabaseException::wrap($e); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function cleanupAfterPublish($action, $languageId, $newId, $parentId, $textMD5) |
61
|
|
|
{ |
62
|
|
|
try { |
63
|
|
|
$this->innerGateway->cleanupAfterPublish($action, $languageId, $newId, $parentId, $textMD5); |
64
|
|
|
} catch (DBALException | PDOException $e) { |
65
|
|
|
throw DatabaseException::wrap($e); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function historizeBeforeSwap($action, $languageMask) |
70
|
|
|
{ |
71
|
|
|
try { |
72
|
|
|
$this->innerGateway->historizeBeforeSwap($action, $languageMask); |
73
|
|
|
} catch (DBALException | PDOException $e) { |
74
|
|
|
throw DatabaseException::wrap($e); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function historizeId($id, $link) |
79
|
|
|
{ |
80
|
|
|
try { |
81
|
|
|
$this->innerGateway->historizeId($id, $link); |
82
|
|
|
} catch (DBALException | PDOException $e) { |
83
|
|
|
throw DatabaseException::wrap($e); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function reparent($oldParentId, $newParentId) |
88
|
|
|
{ |
89
|
|
|
try { |
90
|
|
|
$this->innerGateway->reparent($oldParentId, $newParentId); |
91
|
|
|
} catch (DBALException | PDOException $e) { |
92
|
|
|
throw DatabaseException::wrap($e); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function updateRow($parentId, $textMD5, array $values) |
97
|
|
|
{ |
98
|
|
|
try { |
99
|
|
|
$this->innerGateway->updateRow($parentId, $textMD5, $values); |
100
|
|
|
} catch (DBALException | PDOException $e) { |
101
|
|
|
throw DatabaseException::wrap($e); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function insertRow(array $values) |
106
|
|
|
{ |
107
|
|
|
try { |
108
|
|
|
return $this->innerGateway->insertRow($values); |
109
|
|
|
} catch (DBALException | PDOException $e) { |
110
|
|
|
throw DatabaseException::wrap($e); |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function loadRow($parentId, $textMD5) |
115
|
|
|
{ |
116
|
|
|
try { |
117
|
|
|
return $this->innerGateway->loadRow($parentId, $textMD5); |
118
|
|
|
} catch (DBALException | PDOException $e) { |
119
|
|
|
throw DatabaseException::wrap($e); |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function loadAutogeneratedEntry($action, $parentId = null) |
124
|
|
|
{ |
125
|
|
|
try { |
126
|
|
|
return $this->innerGateway->loadAutogeneratedEntry($action, $parentId); |
127
|
|
|
} catch (DBALException | PDOException $e) { |
128
|
|
|
throw DatabaseException::wrap($e); |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function remove($action, $id = null) |
133
|
|
|
{ |
134
|
|
|
try { |
135
|
|
|
$this->innerGateway->remove($action, $id); |
136
|
|
|
} catch (DBALException | PDOException $e) { |
137
|
|
|
throw DatabaseException::wrap($e); |
138
|
|
|
} |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function listGlobalEntries($languageCode = null, $offset = 0, $limit = -1) |
142
|
|
|
{ |
143
|
|
|
try { |
144
|
|
|
return $this->innerGateway->listGlobalEntries($languageCode, $offset, $limit); |
145
|
|
|
} catch (DBALException | PDOException $e) { |
146
|
|
|
throw DatabaseException::wrap($e); |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function removeCustomAlias($parentId, $textMD5) |
151
|
|
|
{ |
152
|
|
|
try { |
153
|
|
|
return $this->innerGateway->removeCustomAlias($parentId, $textMD5); |
154
|
|
|
} catch (DBALException | PDOException $e) { |
155
|
|
|
throw DatabaseException::wrap($e); |
156
|
|
|
} |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function loadUrlAliasData(array $urlHashes) |
160
|
|
|
{ |
161
|
|
|
try { |
162
|
|
|
return $this->innerGateway->loadUrlAliasData($urlHashes); |
163
|
|
|
} catch (DBALException | PDOException $e) { |
164
|
|
|
throw DatabaseException::wrap($e); |
165
|
|
|
} |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
public function loadPathData($id) |
169
|
|
|
{ |
170
|
|
|
try { |
171
|
|
|
return $this->innerGateway->loadPathData($id); |
172
|
|
|
} catch (DBALException | PDOException $e) { |
173
|
|
|
throw DatabaseException::wrap($e); |
174
|
|
|
} |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public function loadPathDataByHierarchy(array $hierarchyData) |
178
|
|
|
{ |
179
|
|
|
try { |
180
|
|
|
return $this->innerGateway->loadPathDataByHierarchy($hierarchyData); |
181
|
|
|
} catch (DBALException | PDOException $e) { |
182
|
|
|
throw DatabaseException::wrap($e); |
183
|
|
|
} |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
public function loadAutogeneratedEntries($parentId, $includeHistory = false) |
187
|
|
|
{ |
188
|
|
|
try { |
189
|
|
|
return $this->innerGateway->loadAutogeneratedEntries($parentId, $includeHistory); |
190
|
|
|
} catch (DBALException | PDOException $e) { |
191
|
|
|
throw DatabaseException::wrap($e); |
192
|
|
|
} |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
public function getNextId() |
196
|
|
|
{ |
197
|
|
|
try { |
198
|
|
|
return $this->innerGateway->getNextId(); |
199
|
|
|
} catch (DBALException | PDOException $e) { |
200
|
|
|
throw DatabaseException::wrap($e); |
201
|
|
|
} |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
public function getLocationContentMainLanguageId($locationId) |
205
|
|
|
{ |
206
|
|
|
try { |
207
|
|
|
return $this->innerGateway->getLocationContentMainLanguageId($locationId); |
208
|
|
|
} catch (DBALException | PDOException $e) { |
209
|
|
|
throw DatabaseException::wrap($e); |
210
|
|
|
} |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
public function bulkRemoveTranslation($languageId, $actions) |
214
|
|
|
{ |
215
|
|
|
try { |
216
|
|
|
return $this->innerGateway->bulkRemoveTranslation($languageId, $actions); |
217
|
|
|
} catch (DBALException | PDOException $e) { |
218
|
|
|
throw DatabaseException::wrap($e); |
219
|
|
|
} |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
public function archiveUrlAliasesForDeletedTranslations($locationId, $parentId, array $languageIds) |
223
|
|
|
{ |
224
|
|
|
try { |
225
|
|
|
$this->innerGateway->archiveUrlAliasesForDeletedTranslations($locationId, $parentId, $languageIds); |
226
|
|
|
} catch (DBALException | PDOException $e) { |
227
|
|
|
throw DatabaseException::wrap($e); |
228
|
|
|
} |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
public function deleteUrlAliasesWithoutLocation() |
232
|
|
|
{ |
233
|
|
|
try { |
234
|
|
|
return $this->innerGateway->deleteUrlAliasesWithoutLocation(); |
235
|
|
|
} catch (DBALException | PDOException $e) { |
236
|
|
|
throw DatabaseException::wrap($e); |
237
|
|
|
} |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
public function deleteUrlAliasesWithoutParent() |
241
|
|
|
{ |
242
|
|
|
try { |
243
|
|
|
return $this->innerGateway->deleteUrlAliasesWithoutParent(); |
244
|
|
|
} catch (DBALException | PDOException $e) { |
245
|
|
|
throw DatabaseException::wrap($e); |
246
|
|
|
} |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
public function deleteUrlAliasesWithBrokenLink() |
250
|
|
|
{ |
251
|
|
|
try { |
252
|
|
|
return $this->innerGateway->deleteUrlAliasesWithBrokenLink(); |
253
|
|
|
} catch (DBALException | PDOException $e) { |
254
|
|
|
throw DatabaseException::wrap($e); |
255
|
|
|
} |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
public function repairBrokenUrlAliasesForLocation(int $locationId) |
259
|
|
|
{ |
260
|
|
|
try { |
261
|
|
|
return $this->innerGateway->repairBrokenUrlAliasesForLocation($locationId); |
262
|
|
|
} catch (DBALException | PDOException $e) { |
263
|
|
|
throw DatabaseException::wrap($e); |
264
|
|
|
} |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
public function deleteUrlNopAliasesWithoutChildren(): int |
268
|
|
|
{ |
269
|
|
|
try { |
270
|
|
|
return $this->innerGateway->deleteUrlNopAliasesWithoutChildren(); |
271
|
|
|
} catch (DBALException | PDOException $e) { |
272
|
|
|
throw DatabaseException::wrap($e); |
273
|
|
|
} |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
public function getAllChildrenAliases(int $parentId): array |
277
|
|
|
{ |
278
|
|
|
try { |
279
|
|
|
return $this->innerGateway->getAllChildrenAliases($parentId); |
280
|
|
|
} catch (DBALException | PDOException $e) { |
281
|
|
|
throw DatabaseException::wrap($e); |
282
|
|
|
} |
283
|
|
|
} |
284
|
|
|
} |
285
|
|
|
|