Code Duplication    Length = 10-10 lines in 61 locations

eZ/Publish/Core/Persistence/Legacy/Content/Section/Gateway/ExceptionConversion.php 2 locations

@@ 152-161 (lines=10) @@
149
     *
150
     * @return int
151
     */
152
    public function countPoliciesUsingSection($id)
153
    {
154
        try {
155
            return $this->innerGateway->countPoliciesUsingSection($id);
156
        } catch (DBALException $e) {
157
            throw new RuntimeException('Database error', 0, $e);
158
        } catch (PDOException $e) {
159
            throw new RuntimeException('Database error', 0, $e);
160
        }
161
    }
162
163
    /**
164
     * Counts the number of role assignments using section with $id in their limitations.
@@ 170-179 (lines=10) @@
167
     *
168
     * @return int
169
     */
170
    public function countRoleAssignmentsUsingSection($id)
171
    {
172
        try {
173
            return $this->innerGateway->countRoleAssignmentsUsingSection($id);
174
        } catch (DBALException $e) {
175
            throw new RuntimeException('Database error', 0, $e);
176
        } catch (PDOException $e) {
177
            throw new RuntimeException('Database error', 0, $e);
178
        }
179
    }
180
181
    /**
182
     * Deletes the Section with $id.

eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/ExceptionConversion.php 25 locations

@@ 131-140 (lines=10) @@
128
        }
129
    }
130
131
    public function loadGroupData(array $groupIds)
132
    {
133
        try {
134
            return $this->innerGateway->loadGroupData($groupIds);
135
        } catch (DBALException $e) {
136
            throw new RuntimeException('Database error', 0, $e);
137
        } catch (PDOException $e) {
138
            throw new RuntimeException('Database error', 0, $e);
139
        }
140
    }
141
142
    /**
143
     * Returns an array with data about the Group with $identifier.
@@ 51-60 (lines=10) @@
48
     *
49
     * @return mixed Group ID
50
     */
51
    public function insertGroup(Group $group)
52
    {
53
        try {
54
            return $this->innerGateway->insertGroup($group);
55
        } catch (DBALException $e) {
56
            throw new RuntimeException('Database error', 0, $e);
57
        } catch (PDOException $e) {
58
            throw new RuntimeException('Database error', 0, $e);
59
        }
60
    }
61
62
    /**
63
     * Updates a group with data in $group.
@@ 67-76 (lines=10) @@
64
     *
65
     * @param \eZ\Publish\SPI\Persistence\Content\Type\Group\UpdateStruct $group
66
     */
67
    public function updateGroup(GroupUpdateStruct $group)
68
    {
69
        try {
70
            return $this->innerGateway->updateGroup($group);
71
        } catch (DBALException $e) {
72
            throw new RuntimeException('Database error', 0, $e);
73
        } catch (PDOException $e) {
74
            throw new RuntimeException('Database error', 0, $e);
75
        }
76
    }
77
78
    /**
79
     * Returns the number of types in a certain group.
@@ 85-94 (lines=10) @@
82
     *
83
     * @return int
84
     */
85
    public function countTypesInGroup($groupId)
86
    {
87
        try {
88
            return $this->innerGateway->countTypesInGroup($groupId);
89
        } catch (DBALException $e) {
90
            throw new RuntimeException('Database error', 0, $e);
91
        } catch (PDOException $e) {
92
            throw new RuntimeException('Database error', 0, $e);
93
        }
94
    }
95
96
    /**
97
     * Returns the number of Groups the type is assigned to.
@@ 104-113 (lines=10) @@
101
     *
102
     * @return int
103
     */
104
    public function countGroupsForType($typeId, $status)
105
    {
106
        try {
107
            return $this->innerGateway->countGroupsForType($typeId, $status);
108
        } catch (DBALException $e) {
109
            throw new RuntimeException('Database error', 0, $e);
110
        } catch (PDOException $e) {
111
            throw new RuntimeException('Database error', 0, $e);
112
        }
113
    }
114
115
    /**
116
     * Deletes the Group with the given $groupId.
@@ 120-129 (lines=10) @@
117
     *
118
     * @param int $groupId
119
     */
120
    public function deleteGroup($groupId)
121
    {
122
        try {
123
            return $this->innerGateway->deleteGroup($groupId);
124
        } catch (DBALException $e) {
125
            throw new RuntimeException('Database error', 0, $e);
126
        } catch (PDOException $e) {
127
            throw new RuntimeException('Database error', 0, $e);
128
        }
129
    }
130
131
    public function loadGroupData(array $groupIds)
132
    {
@@ 149-158 (lines=10) @@
146
     *
147
     * @return array
148
     */
149
    public function loadGroupDataByIdentifier($identifier)
150
    {
151
        try {
152
            return $this->innerGateway->loadGroupDataByIdentifier($identifier);
153
        } catch (DBALException $e) {
154
            throw new RuntimeException('Database error', 0, $e);
155
        } catch (PDOException $e) {
156
            throw new RuntimeException('Database error', 0, $e);
157
        }
158
    }
159
160
    /**
161
     * Returns an array with data about all Group objects.
@@ 165-174 (lines=10) @@
162
     *
163
     * @return array
164
     */
165
    public function loadAllGroupsData()
166
    {
167
        try {
168
            return $this->innerGateway->loadAllGroupsData();
169
        } catch (DBALException $e) {
170
            throw new RuntimeException('Database error', 0, $e);
171
        } catch (PDOException $e) {
172
            throw new RuntimeException('Database error', 0, $e);
173
        }
174
    }
175
176
    /**
177
     * Loads data for all Types in $status in $groupId.
@@ 184-193 (lines=10) @@
181
     *
182
     * @return string[][]
183
     */
184
    public function loadTypesDataForGroup($groupId, $status)
185
    {
186
        try {
187
            return $this->innerGateway->loadTypesDataForGroup($groupId, $status);
188
        } catch (DBALException $e) {
189
            throw new RuntimeException('Database error', 0, $e);
190
        } catch (PDOException $e) {
191
            throw new RuntimeException('Database error', 0, $e);
192
        }
193
    }
194
195
    /**
196
     * Inserts a new content type.
@@ 203-212 (lines=10) @@
200
     *
201
     * @return mixed Type ID
202
     */
203
    public function insertType(Type $type, $typeId = null)
204
    {
205
        try {
206
            return $this->innerGateway->insertType($type, $typeId);
207
        } catch (DBALException $e) {
208
            throw new RuntimeException('Database error', 0, $e);
209
        } catch (PDOException $e) {
210
            throw new RuntimeException('Database error', 0, $e);
211
        }
212
    }
213
214
    /**
215
     * Insert assignment of $typeId to $groupId.
@@ 221-230 (lines=10) @@
218
     * @param int $status
219
     * @param mixed $groupId
220
     */
221
    public function insertGroupAssignment($typeId, $status, $groupId)
222
    {
223
        try {
224
            return $this->innerGateway->insertGroupAssignment($typeId, $status, $groupId);
225
        } catch (DBALException $e) {
226
            throw new RuntimeException('Database error', 0, $e);
227
        } catch (PDOException $e) {
228
            throw new RuntimeException('Database error', 0, $e);
229
        }
230
    }
231
232
    /**
233
     * Deletes a group assignments for a Type.
@@ 239-248 (lines=10) @@
236
     * @param mixed $typeId
237
     * @param int $status
238
     */
239
    public function deleteGroupAssignment($groupId, $typeId, $status)
240
    {
241
        try {
242
            return $this->innerGateway->deleteGroupAssignment($groupId, $typeId, $status);
243
        } catch (DBALException $e) {
244
            throw new RuntimeException('Database error', 0, $e);
245
        } catch (PDOException $e) {
246
            throw new RuntimeException('Database error', 0, $e);
247
        }
248
    }
249
250
    /**
251
     * Loads an array with data about field definition referred $id and $status.
@@ 258-267 (lines=10) @@
255
     *
256
     * @return array Data rows.
257
     */
258
    public function loadFieldDefinition($id, $status)
259
    {
260
        try {
261
            return $this->innerGateway->loadFieldDefinition($id, $status);
262
        } catch (DBALException $e) {
263
            throw new RuntimeException('Database error', 0, $e);
264
        } catch (PDOException $e) {
265
            throw new RuntimeException('Database error', 0, $e);
266
        }
267
    }
268
269
    /**
270
     * Inserts a $fieldDefinition for $typeId.
@@ 301-310 (lines=10) @@
298
     * @param int $status
299
     * @param mixed $fieldDefinitionId
300
     */
301
    public function deleteFieldDefinition($typeId, $status, $fieldDefinitionId)
302
    {
303
        try {
304
            return $this->innerGateway->deleteFieldDefinition($typeId, $status, $fieldDefinitionId);
305
        } catch (DBALException $e) {
306
            throw new RuntimeException('Database error', 0, $e);
307
        } catch (PDOException $e) {
308
            throw new RuntimeException('Database error', 0, $e);
309
        }
310
    }
311
312
    /**
313
     * Updates a $fieldDefinition for $typeId.
@@ 342-351 (lines=10) @@
339
     * @param int $status
340
     * @param \eZ\Publish\SPI\Persistence\Content\Type\UpdateStruct $updateStruct
341
     */
342
    public function updateType($typeId, $status, UpdateStruct $updateStruct)
343
    {
344
        try {
345
            return $this->innerGateway->updateType($typeId, $status, $updateStruct);
346
        } catch (DBALException $e) {
347
            throw new RuntimeException('Database error', 0, $e);
348
        } catch (PDOException $e) {
349
            throw new RuntimeException('Database error', 0, $e);
350
        }
351
    }
352
353
    /**
354
     * Loads an array with data about $typeId in $status.
@@ 361-370 (lines=10) @@
358
     *
359
     * @return array Data rows.
360
     */
361
    public function loadTypeData($typeId, $status)
362
    {
363
        try {
364
            return $this->innerGateway->loadTypeData($typeId, $status);
365
        } catch (DBALException $e) {
366
            throw new RuntimeException('Database error', 0, $e);
367
        } catch (PDOException $e) {
368
            throw new RuntimeException('Database error', 0, $e);
369
        }
370
    }
371
372
    /**
373
     * Loads an array with data about the type referred to by $identifier in
@@ 381-390 (lines=10) @@
378
     *
379
     * @return array(int=>array(string=>mixed)) Data rows.
380
     */
381
    public function loadTypeDataByIdentifier($identifier, $status)
382
    {
383
        try {
384
            return $this->innerGateway->loadTypeDataByIdentifier($identifier, $status);
385
        } catch (DBALException $e) {
386
            throw new RuntimeException('Database error', 0, $e);
387
        } catch (PDOException $e) {
388
            throw new RuntimeException('Database error', 0, $e);
389
        }
390
    }
391
392
    /**
393
     * Loads an array with data about the type referred to by $remoteId in
@@ 401-410 (lines=10) @@
398
     *
399
     * @return array(int=>array(string=>mixed)) Data rows.
400
     */
401
    public function loadTypeDataByRemoteId($remoteId, $status)
402
    {
403
        try {
404
            return $this->innerGateway->loadTypeDataByRemoteId($remoteId, $status);
405
        } catch (DBALException $e) {
406
            throw new RuntimeException('Database error', 0, $e);
407
        } catch (PDOException $e) {
408
            throw new RuntimeException('Database error', 0, $e);
409
        }
410
    }
411
412
    /**
413
     * Counts the number of instances that exists of the identified type.
@@ 419-428 (lines=10) @@
416
     *
417
     * @return int
418
     */
419
    public function countInstancesOfType($typeId)
420
    {
421
        try {
422
            return $this->innerGateway->countInstancesOfType($typeId);
423
        } catch (DBALException $e) {
424
            throw new RuntimeException('Database error', 0, $e);
425
        } catch (PDOException $e) {
426
            throw new RuntimeException('Database error', 0, $e);
427
        }
428
    }
429
430
    /**
431
     * Deletes a Type completely.
@@ 436-445 (lines=10) @@
433
     * @param mixed $typeId
434
     * @param int $status
435
     */
436
    public function delete($typeId, $status)
437
    {
438
        try {
439
            return $this->innerGateway->delete($typeId, $status);
440
        } catch (DBALException $e) {
441
            throw new RuntimeException('Database error', 0, $e);
442
        } catch (PDOException $e) {
443
            throw new RuntimeException('Database error', 0, $e);
444
        }
445
    }
446
447
    /**
448
     * Deletes all field definitions of a Type.
@@ 453-462 (lines=10) @@
450
     * @param mixed $typeId
451
     * @param int $status
452
     */
453
    public function deleteFieldDefinitionsForType($typeId, $status)
454
    {
455
        try {
456
            return $this->innerGateway->deleteFieldDefinitionsForType($typeId, $status);
457
        } catch (DBALException $e) {
458
            throw new RuntimeException('Database error', 0, $e);
459
        } catch (PDOException $e) {
460
            throw new RuntimeException('Database error', 0, $e);
461
        }
462
    }
463
464
    /**
465
     * Deletes a the Type.
@@ 472-481 (lines=10) @@
469
     * @param mixed $typeId
470
     * @param int $status
471
     */
472
    public function deleteType($typeId, $status)
473
    {
474
        try {
475
            return $this->innerGateway->deleteType($typeId, $status);
476
        } catch (DBALException $e) {
477
            throw new RuntimeException('Database error', 0, $e);
478
        } catch (PDOException $e) {
479
            throw new RuntimeException('Database error', 0, $e);
480
        }
481
    }
482
483
    /**
484
     * Deletes all group assignments for a Type.
@@ 489-498 (lines=10) @@
486
     * @param mixed $typeId
487
     * @param int $status
488
     */
489
    public function deleteGroupAssignmentsForType($typeId, $status)
490
    {
491
        try {
492
            return $this->innerGateway->deleteGroupAssignmentsForType($typeId, $status);
493
        } catch (DBALException $e) {
494
            throw new RuntimeException('Database error', 0, $e);
495
        } catch (PDOException $e) {
496
            throw new RuntimeException('Database error', 0, $e);
497
        }
498
    }
499
500
    /**
501
     * Publishes the Type with $typeId from $sourceVersion to $targetVersion,
@@ 508-517 (lines=10) @@
505
     * @param int $sourceStatus
506
     * @param int $targetStatus
507
     */
508
    public function publishTypeAndFields($typeId, $sourceStatus, $targetStatus)
509
    {
510
        try {
511
            return $this->innerGateway->publishTypeAndFields($typeId, $sourceStatus, $targetStatus);
512
        } catch (DBALException $e) {
513
            throw new RuntimeException('Database error', 0, $e);
514
        } catch (PDOException $e) {
515
            throw new RuntimeException('Database error', 0, $e);
516
        }
517
    }
518
519
    /**
520
     * Returns searchable field mapping data.
@@ 524-533 (lines=10) @@
521
     *
522
     * @return array
523
     */
524
    public function getSearchableFieldMapData()
525
    {
526
        try {
527
            return $this->innerGateway->getSearchableFieldMapData();
528
        } catch (DBALException $e) {
529
            throw new RuntimeException('Database error', 0, $e);
530
        } catch (PDOException $e) {
531
            throw new RuntimeException('Database error', 0, $e);
532
        }
533
    }
534
}
535

eZ/Publish/Core/Persistence/Legacy/URL/Gateway/ExceptionConversion.php 4 locations

@@ 38-47 (lines=10) @@
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function updateUrl(URL $url)
39
    {
40
        try {
41
            return $this->innerGateway->updateUrl($url);
42
        } catch (DBALException $e) {
43
            throw new RuntimeException('Database error', 0, $e);
44
        } catch (PDOException $e) {
45
            throw new RuntimeException('Database error', 0, $e);
46
        }
47
    }
48
49
    /**
50
     * {@inheritdoc}
@@ 66-75 (lines=10) @@
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function findUsages($id)
67
    {
68
        try {
69
            return $this->innerGateway->findUsages($id);
70
        } catch (DBALException $e) {
71
            throw new RuntimeException('Database error', 0, $e);
72
        } catch (PDOException $e) {
73
            throw new RuntimeException('Database error', 0, $e);
74
        }
75
    }
76
77
    /**
78
     * {@inheritdoc}
@@ 80-89 (lines=10) @@
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function loadUrlData($id)
81
    {
82
        try {
83
            return $this->innerGateway->loadUrlData($id);
84
        } catch (DBALException $e) {
85
            throw new RuntimeException('Database error', 0, $e);
86
        } catch (PDOException $e) {
87
            throw new RuntimeException('Database error', 0, $e);
88
        }
89
    }
90
91
    /**
92
     * {@inheritdoc}
@@ 94-103 (lines=10) @@
91
    /**
92
     * {@inheritdoc}
93
     */
94
    public function loadUrlDataByUrl($url)
95
    {
96
        try {
97
            return $this->innerGateway->loadUrlDataByUrl($url);
98
        } catch (DBALException $e) {
99
            throw new RuntimeException('Database error', 0, $e);
100
        } catch (PDOException $e) {
101
            throw new RuntimeException('Database error', 0, $e);
102
        }
103
    }
104
}
105

eZ/Publish/Core/Persistence/Legacy/User/Gateway/ExceptionConversion.php 4 locations

@@ 117-126 (lines=10) @@
114
     *
115
     * @return array
116
     */
117
    public function loadByEmail($email)
118
    {
119
        try {
120
            return $this->innerGateway->loadByEmail($email);
121
        } catch (\DBALException $e) {
122
            throw new \RuntimeException('Database error', 0, $e);
123
        } catch (\PDOException $e) {
124
            throw new \RuntimeException('Database error', 0, $e);
125
        }
126
    }
127
128
    /**
129
     * Loads a user with user hash key.
@@ 135-144 (lines=10) @@
132
     *
133
     * @return array
134
     */
135
    public function loadUserByToken($hash)
136
    {
137
        try {
138
            return $this->innerGateway->loadUserByToken($hash);
139
        } catch (DBALException $e) {
140
            throw new \RuntimeException('Database error', 0, $e);
141
        } catch (\PDOException $e) {
142
            throw new \RuntimeException('Database error', 0, $e);
143
        }
144
    }
145
146
    /**
147
     * Update the user information specified by the user struct.
@@ 167-176 (lines=10) @@
164
     *
165
     * @param UserTokenUpdateStruct $userTokenUpdateStruct
166
     */
167
    public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct)
168
    {
169
        try {
170
            return $this->innerGateway->updateUserToken($userTokenUpdateStruct);
171
        } catch (DBALException $e) {
172
            throw new RuntimeException('Database error', 0, $e);
173
        } catch (PDOException $e) {
174
            throw new RuntimeException('Database error', 0, $e);
175
        }
176
    }
177
178
    /**
179
     * Expires user token with user hash.
@@ 183-192 (lines=10) @@
180
     *
181
     * @param string $hash
182
     */
183
    public function expireUserToken($hash)
184
    {
185
        try {
186
            return $this->innerGateway->expireUserToken($hash);
187
        } catch (DBALException $e) {
188
            throw new RuntimeException('Database error', 0, $e);
189
        } catch (PDOException $e) {
190
            throw new RuntimeException('Database error', 0, $e);
191
        }
192
    }
193
194
    /**
195
     * Assigns role to user with given limitation.

eZ/Publish/Core/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php 24 locations

@@ 640-649 (lines=10) @@
637
     *
638
     * @return int
639
     */
640
    public function countAllLocations()
641
    {
642
        try {
643
            return $this->innerGateway->countAllLocations();
644
        } catch (DBALException $e) {
645
            throw new RuntimeException('Database error', 0, $e);
646
        } catch (PDOException $e) {
647
            throw new RuntimeException('Database error', 0, $e);
648
        }
649
    }
650
651
    /**
652
     * Load data of every Location, except the Root node.
@@ 659-668 (lines=10) @@
656
     *
657
     * @return array
658
     */
659
    public function loadAllLocationsData($offset, $limit)
660
    {
661
        try {
662
            return $this->innerGateway->loadAllLocationsData($offset, $limit);
663
        } catch (DBALException $e) {
664
            throw new RuntimeException('Database error', 0, $e);
665
        } catch (PDOException $e) {
666
            throw new RuntimeException('Database error', 0, $e);
667
        }
668
    }
669
}
670
@@ 54-63 (lines=10) @@
51
     *
52
     * @return array
53
     */
54
    public function getBasicNodeData($nodeId)
55
    {
56
        try {
57
            return $this->innerGateway->getBasicNodeData($nodeId);
58
        } catch (DBALException $e) {
59
            throw new RuntimeException('Database error', 0, $e);
60
        } catch (PDOException $e) {
61
            throw new RuntimeException('Database error', 0, $e);
62
        }
63
    }
64
65
    /**
66
     * Returns an array with basic node data for the node with $remoteId.
@@ 74-83 (lines=10) @@
71
     *
72
     * @return array
73
     */
74
    public function getBasicNodeDataByRemoteId($remoteId)
75
    {
76
        try {
77
            return $this->innerGateway->getBasicNodeDataByRemoteId($remoteId);
78
        } catch (DBALException $e) {
79
            throw new RuntimeException('Database error', 0, $e);
80
        } catch (PDOException $e) {
81
            throw new RuntimeException('Database error', 0, $e);
82
        }
83
    }
84
85
    /**
86
     * Returns total count and data for all Locations satisfying the parameters.
@@ 129-138 (lines=10) @@
126
    /**
127
     * @see \eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway::loadParentLocationsDataForDraftContent
128
     */
129
    public function loadParentLocationsDataForDraftContent($contentId)
130
    {
131
        try {
132
            return $this->innerGateway->loadParentLocationsDataForDraftContent($contentId);
133
        } catch (DBALException $e) {
134
            throw new RuntimeException('Database error', 0, $e);
135
        } catch (PDOException $e) {
136
            throw new RuntimeException('Database error', 0, $e);
137
        }
138
    }
139
140
    /**
141
     * Find all content in the given subtree.
@@ 148-157 (lines=10) @@
145
     *
146
     * @return array
147
     */
148
    public function getSubtreeContent($sourceId, $onlyIds = false)
149
    {
150
        try {
151
            return $this->innerGateway->getSubtreeContent($sourceId, $onlyIds);
152
        } catch (DBALException $e) {
153
            throw new RuntimeException('Database error', 0, $e);
154
        } catch (PDOException $e) {
155
            throw new RuntimeException('Database error', 0, $e);
156
        }
157
    }
158
159
    /**
160
     * Returns data for the first level children of the location identified by given $locationId.
@@ 166-175 (lines=10) @@
163
     *
164
     * @return array
165
     */
166
    public function getChildren($locationId)
167
    {
168
        try {
169
            return $this->innerGateway->getChildren($locationId);
170
        } catch (DBALException $e) {
171
            throw new RuntimeException('Database error', 0, $e);
172
        } catch (PDOException $e) {
173
            throw new RuntimeException('Database error', 0, $e);
174
        }
175
    }
176
177
    /**
178
     * Update path strings to move nodes in the ezcontentobject_tree table.
@@ 188-197 (lines=10) @@
185
     * @param array $fromPathString
186
     * @param array $toPathString
187
     */
188
    public function moveSubtreeNodes(array $fromPathString, array $toPathString)
189
    {
190
        try {
191
            return $this->innerGateway->moveSubtreeNodes($fromPathString, $toPathString);
192
        } catch (DBALException $e) {
193
            throw new RuntimeException('Database error', 0, $e);
194
        } catch (PDOException $e) {
195
            throw new RuntimeException('Database error', 0, $e);
196
        }
197
    }
198
199
    /**
200
     * Updated subtree modification time for all nodes on path.
@@ 205-214 (lines=10) @@
202
     * @param string $pathString
203
     * @param int|null $timestamp
204
     */
205
    public function updateSubtreeModificationTime($pathString, $timestamp = null)
206
    {
207
        try {
208
            return $this->innerGateway->updateSubtreeModificationTime($pathString, $timestamp);
209
        } catch (DBALException $e) {
210
            throw new RuntimeException('Database error', 0, $e);
211
        } catch (PDOException $e) {
212
            throw new RuntimeException('Database error', 0, $e);
213
        }
214
    }
215
216
    /**
217
     * Update node assignment table.
@@ 276-285 (lines=10) @@
273
     *
274
     * @param string $pathString
275
     */
276
    public function hideSubtree($pathString)
277
    {
278
        try {
279
            return $this->innerGateway->hideSubtree($pathString);
280
        } catch (DBALException $e) {
281
            throw new RuntimeException('Database error', 0, $e);
282
        } catch (PDOException $e) {
283
            throw new RuntimeException('Database error', 0, $e);
284
        }
285
    }
286
287
    /**
288
     * Sets a location to be unhidden, and self + children to visible unless a parent is hiding the tree.
@@ 293-302 (lines=10) @@
290
     *
291
     * @param string $pathString
292
     */
293
    public function unHideSubtree($pathString)
294
    {
295
        try {
296
            return $this->innerGateway->unHideSubtree($pathString);
297
        } catch (DBALException $e) {
298
            throw new RuntimeException('Database error', 0, $e);
299
        } catch (PDOException $e) {
300
            throw new RuntimeException('Database error', 0, $e);
301
        }
302
    }
303
304
    /**
305
     * Swaps the content object being pointed to by a location object.
@@ 315-324 (lines=10) @@
312
     *
313
     * @return bool
314
     */
315
    public function swap($locationId1, $locationId2)
316
    {
317
        try {
318
            return $this->innerGateway->swap($locationId1, $locationId2);
319
        } catch (DBALException $e) {
320
            throw new RuntimeException('Database error', 0, $e);
321
        } catch (PDOException $e) {
322
            throw new RuntimeException('Database error', 0, $e);
323
        }
324
    }
325
326
    /**
327
     * Creates a new location in given $parentNode.
@@ 334-343 (lines=10) @@
331
     *
332
     * @return \eZ\Publish\SPI\Persistence\Content\Location
333
     */
334
    public function create(CreateStruct $createStruct, array $parentNode)
335
    {
336
        try {
337
            return $this->innerGateway->create($createStruct, $parentNode);
338
        } catch (DBALException $e) {
339
            throw new RuntimeException('Database error', 0, $e);
340
        } catch (PDOException $e) {
341
            throw new RuntimeException('Database error', 0, $e);
342
        }
343
    }
344
345
    /**
346
     * Create an entry in the node assignment table.
@@ 352-361 (lines=10) @@
349
     * @param mixed $parentNodeId
350
     * @param int $type
351
     */
352
    public function createNodeAssignment(CreateStruct $createStruct, $parentNodeId, $type = self::NODE_ASSIGNMENT_OP_CODE_CREATE_NOP)
353
    {
354
        try {
355
            return $this->innerGateway->createNodeAssignment($createStruct, $parentNodeId, $type);
356
        } catch (DBALException $e) {
357
            throw new RuntimeException('Database error', 0, $e);
358
        } catch (PDOException $e) {
359
            throw new RuntimeException('Database error', 0, $e);
360
        }
361
    }
362
363
    /**
364
     * Deletes node assignment for given $contentId and $versionNo.
@@ 388-397 (lines=10) @@
385
     * @param \eZ\Publish\SPI\Persistence\Content\Location\UpdateStruct $location
386
     * @param int $locationId
387
     */
388
    public function update(UpdateStruct $location, $locationId)
389
    {
390
        try {
391
            return $this->innerGateway->update($location, $locationId);
392
        } catch (DBALException $e) {
393
            throw new RuntimeException('Database error', 0, $e);
394
        } catch (PDOException $e) {
395
            throw new RuntimeException('Database error', 0, $e);
396
        }
397
    }
398
399
    /**
400
     * Updates path identification string for given $locationId.
@@ 406-415 (lines=10) @@
403
     * @param mixed $parentLocationId
404
     * @param string $text
405
     */
406
    public function updatePathIdentificationString($locationId, $parentLocationId, $text)
407
    {
408
        try {
409
            return $this->innerGateway->updatePathIdentificationString($locationId, $parentLocationId, $text);
410
        } catch (DBALException $e) {
411
            throw new RuntimeException('Database error', 0, $e);
412
        } catch (PDOException $e) {
413
            throw new RuntimeException('Database error', 0, $e);
414
        }
415
    }
416
417
    /**
418
     * Deletes ezcontentobject_tree row for given $locationId (node_id).
@@ 422-431 (lines=10) @@
419
     *
420
     * @param mixed $locationId
421
     */
422
    public function removeLocation($locationId)
423
    {
424
        try {
425
            return $this->innerGateway->removeLocation($locationId);
426
        } catch (DBALException $e) {
427
            throw new RuntimeException('Database error', 0, $e);
428
        } catch (PDOException $e) {
429
            throw new RuntimeException('Database error', 0, $e);
430
        }
431
    }
432
433
    /**
434
     * Returns id of the next in line node to be set as a new main node.
@@ 465-474 (lines=10) @@
462
     *
463
     * @return bool
464
     */
465
    public function trashLocation($locationId)
466
    {
467
        try {
468
            return $this->innerGateway->trashLocation($locationId);
469
        } catch (DBALException $e) {
470
            throw new RuntimeException('Database error', 0, $e);
471
        } catch (PDOException $e) {
472
            throw new RuntimeException('Database error', 0, $e);
473
        }
474
    }
475
476
    /**
477
     * Returns a trashed location to normal state.
@@ 489-498 (lines=10) @@
486
     *
487
     * @return \eZ\Publish\SPI\Persistence\Content\Location
488
     */
489
    public function untrashLocation($locationId, $newParentId = null)
490
    {
491
        try {
492
            return $this->innerGateway->untrashLocation($locationId, $newParentId);
493
        } catch (DBALException $e) {
494
            throw new RuntimeException('Database error', 0, $e);
495
        } catch (PDOException $e) {
496
            throw new RuntimeException('Database error', 0, $e);
497
        }
498
    }
499
500
    /**
501
     * Loads trash data specified by location ID.
@@ 507-516 (lines=10) @@
504
     *
505
     * @return array
506
     */
507
    public function loadTrashByLocation($locationId)
508
    {
509
        try {
510
            return $this->innerGateway->loadTrashByLocation($locationId);
511
        } catch (DBALException $e) {
512
            throw new RuntimeException('Database error', 0, $e);
513
        } catch (PDOException $e) {
514
            throw new RuntimeException('Database error', 0, $e);
515
        }
516
    }
517
518
    /**
519
     * Removes every entries in the trash.
@@ 524-533 (lines=10) @@
521
     *
522
     * Basically truncates ezcontentobject_trash table.
523
     */
524
    public function cleanupTrash()
525
    {
526
        try {
527
            return $this->innerGateway->cleanupTrash();
528
        } catch (DBALException $e) {
529
            throw new RuntimeException('Database error', 0, $e);
530
        } catch (PDOException $e) {
531
            throw new RuntimeException('Database error', 0, $e);
532
        }
533
    }
534
535
    /**
536
     * Lists trashed items.
@@ 562-571 (lines=10) @@
559
     *
560
     * @param int $id The trashed location Id
561
     */
562
    public function removeElementFromTrash($id)
563
    {
564
        try {
565
            return $this->innerGateway->removeElementFromTrash($id);
566
        } catch (DBALException $e) {
567
            throw new RuntimeException('Database error', 0, $e);
568
        } catch (PDOException $e) {
569
            throw new RuntimeException('Database error', 0, $e);
570
        }
571
    }
572
573
    /**
574
     * Set section on all content objects in the subtree.
@@ 581-590 (lines=10) @@
578
     *
579
     * @return bool
580
     */
581
    public function setSectionForSubtree($pathString, $sectionId)
582
    {
583
        try {
584
            return $this->innerGateway->setSectionForSubtree($pathString, $sectionId);
585
        } catch (DBALException $e) {
586
            throw new RuntimeException('Database error', 0, $e);
587
        } catch (PDOException $e) {
588
            throw new RuntimeException('Database error', 0, $e);
589
        }
590
    }
591
592
    /**
593
     * Returns how many locations given content object identified by $contentId has.
@@ 599-608 (lines=10) @@
596
     *
597
     * @return int
598
     */
599
    public function countLocationsByContentId($contentId)
600
    {
601
        try {
602
            return $this->innerGateway->countLocationsByContentId($contentId);
603
        } catch (DBALException $e) {
604
            throw new RuntimeException('Database error', 0, $e);
605
        } catch (PDOException $e) {
606
            throw new RuntimeException('Database error', 0, $e);
607
        }
608
    }
609
610
    /**
611
     * Changes main location of content identified by given $contentId to location identified by given $locationId.

eZ/Publish/Core/Persistence/Legacy/Content/Language/Gateway/ExceptionConversion.php 2 locations

@@ 76-85 (lines=10) @@
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function loadLanguageListData(array $ids): iterable
77
    {
78
        try {
79
            return $this->innerGateway->loadLanguageListData($ids);
80
        } catch (DBALException $e) {
81
            throw new RuntimeException('Database error', 0, $e);
82
        } catch (PDOException $e) {
83
            throw new RuntimeException('Database error', 0, $e);
84
        }
85
    }
86
87
    /**
88
     * {@inheritdoc}
@@ 90-99 (lines=10) @@
87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function loadLanguageListDataByLanguageCode(array $languageCodes): iterable
91
    {
92
        try {
93
            return $this->innerGateway->loadLanguageListDataByLanguageCode($languageCodes);
94
        } catch (DBALException $e) {
95
            throw new RuntimeException('Database error', 0, $e);
96
        } catch (PDOException $e) {
97
            throw new RuntimeException('Database error', 0, $e);
98
        }
99
    }
100
101
    /**
102
     * Loads the data for all languages.