Code Duplication    Length = 10-10 lines in 52 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/UrlAlias/Gateway/ExceptionConversion.php 5 locations

@@ 38-47 (lines=10) @@
35
        $this->innerGateway = $innerGateway;
36
    }
37
38
    public function setTable($name)
39
    {
40
        try {
41
            return $this->innerGateway->setTable($name);
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
     * Loads list of aliases by given $locationId.
@@ 114-123 (lines=10) @@
111
        }
112
    }
113
114
    public function historizeBeforeSwap($action, $languageMask)
115
    {
116
        try {
117
            $this->innerGateway->historizeBeforeSwap($action, $languageMask);
118
        } catch (DBALException $e) {
119
            throw new \RuntimeException('Database error', 0, $e);
120
        } catch (PDOException $e) {
121
            throw new \RuntimeException('Database error', 0, $e);
122
        }
123
    }
124
125
    /**
126
     * Marks all entries with given $id as history entries.
@@ 248-257 (lines=10) @@
245
     * @param string $action
246
     * @param mixed|null $id
247
     */
248
    public function remove($action, $id = null)
249
    {
250
        try {
251
            $this->innerGateway->remove($action, $id);
252
        } catch (DBALException $e) {
253
            throw new \RuntimeException('Database error', 0, $e);
254
        } catch (PDOException $e) {
255
            throw new \RuntimeException('Database error', 0, $e);
256
        }
257
    }
258
259
    /**
260
     * Loads paged list of global aliases.
@@ 394-403 (lines=10) @@
391
        }
392
    }
393
394
    public function getLocationContentMainLanguageId($locationId)
395
    {
396
        try {
397
            return $this->innerGateway->getLocationContentMainLanguageId($locationId);
398
        } catch (DBALException $e) {
399
            throw new \RuntimeException('Database error', 0, $e);
400
        } catch (PDOException $e) {
401
            throw new \RuntimeException('Database error', 0, $e);
402
        }
403
    }
404
405
    /**
406
     * {@inheritdoc}
@@ 408-417 (lines=10) @@
405
    /**
406
     * {@inheritdoc}
407
     */
408
    public function bulkRemoveTranslation($languageId, $actions)
409
    {
410
        try {
411
            return $this->innerGateway->bulkRemoveTranslation($languageId, $actions);
412
        } catch (DBALException $e) {
413
            throw new \RuntimeException('Database error', 0, $e);
414
        } catch (PDOException $e) {
415
            throw new \RuntimeException('Database error', 0, $e);
416
        }
417
    }
418
419
    /**
420
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Legacy/Content/Type/Gateway/ExceptionConversion.php 1 location

@@ 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.

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/Gateway/ExceptionConversion.php 36 locations

@@ 51-60 (lines=10) @@
48
     *
49
     * @return array
50
     */
51
    public function getContext()
52
    {
53
        try {
54
            return $this->innerGateway->getContext();
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
     * Inserts a new content object.
@@ 70-79 (lines=10) @@
67
     *
68
     * @return int ID
69
     */
70
    public function insertContentObject(CreateStruct $struct, $currentVersionNo = 1)
71
    {
72
        try {
73
            return $this->innerGateway->insertContentObject($struct, $currentVersionNo);
74
        } catch (DBALException $e) {
75
            throw new RuntimeException('Database error', 0, $e);
76
        } catch (PDOException $e) {
77
            throw new RuntimeException('Database error', 0, $e);
78
        }
79
    }
80
81
    /**
82
     * Inserts a new version.
@@ 89-98 (lines=10) @@
86
     *
87
     * @return int ID
88
     */
89
    public function insertVersion(VersionInfo $versionInfo, array $fields)
90
    {
91
        try {
92
            return $this->innerGateway->insertVersion($versionInfo, $fields);
93
        } catch (DBALException $e) {
94
            throw new RuntimeException('Database error', 0, $e);
95
        } catch (PDOException $e) {
96
            throw new RuntimeException('Database error', 0, $e);
97
        }
98
    }
99
100
    /**
101
     * Updates an existing content identified by $contentId in respect to $struct.
@@ 107-116 (lines=10) @@
104
     * @param \eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct $struct
105
     * @param \eZ\Publish\SPI\Persistence\Content\VersionInfo $prePublishVersionInfo Provided on publish
106
     */
107
    public function updateContent($contentId, MetadataUpdateStruct $struct, VersionInfo $prePublishVersionInfo = null)
108
    {
109
        try {
110
            return $this->innerGateway->updateContent($contentId, $struct, $prePublishVersionInfo);
111
        } catch (DBALException $e) {
112
            throw new RuntimeException('Database error', 0, $e);
113
        } catch (PDOException $e) {
114
            throw new RuntimeException('Database error', 0, $e);
115
        }
116
    }
117
118
    /**
119
     * Updates version $versionNo for content identified by $contentId, in respect to $struct.
@@ 125-134 (lines=10) @@
122
     * @param int $versionNo
123
     * @param \eZ\Publish\SPI\Persistence\Content\UpdateStruct $struct
124
     */
125
    public function updateVersion($contentId, $versionNo, UpdateStruct $struct)
126
    {
127
        try {
128
            return $this->innerGateway->updateVersion($contentId, $versionNo, $struct);
129
        } catch (DBALException $e) {
130
            throw new RuntimeException('Database error', 0, $e);
131
        } catch (PDOException $e) {
132
            throw new RuntimeException('Database error', 0, $e);
133
        }
134
    }
135
136
    /**
137
     * Updates "always available" flag for content identified by $contentId, in respect to $alwaysAvailable.
@@ 142-151 (lines=10) @@
139
     * @param int $contentId
140
     * @param bool $newAlwaysAvailable New "always available" value
141
     */
142
    public function updateAlwaysAvailableFlag($contentId, $newAlwaysAvailable)
143
    {
144
        try {
145
            return $this->innerGateway->updateAlwaysAvailableFlag($contentId, $newAlwaysAvailable);
146
        } catch (DBALException $e) {
147
            throw new RuntimeException('Database error', 0, $e);
148
        } catch (PDOException $e) {
149
            throw new RuntimeException('Database error', 0, $e);
150
        }
151
    }
152
153
    /**
154
     * Sets the state of object identified by $contentId and $version to $state.
@@ 164-173 (lines=10) @@
161
     *
162
     * @return bool
163
     */
164
    public function setStatus($contentId, $version, $status)
165
    {
166
        try {
167
            return $this->innerGateway->setStatus($contentId, $version, $status);
168
        } catch (DBALException $e) {
169
            throw new RuntimeException('Database error', 0, $e);
170
        } catch (PDOException $e) {
171
            throw new RuntimeException('Database error', 0, $e);
172
        }
173
    }
174
175
    /**
176
     * Inserts a new field.
@@ 268-277 (lines=10) @@
265
     *
266
     * @return array
267
     */
268
    public function load($contentId, $version, array $translations = null)
269
    {
270
        try {
271
            return $this->innerGateway->load($contentId, $version, $translations);
272
        } catch (DBALException $e) {
273
            throw new RuntimeException('Database error', 0, $e);
274
        } catch (PDOException $e) {
275
            throw new RuntimeException('Database error', 0, $e);
276
        }
277
    }
278
279
    /**
280
     * Loads data for a content object identified by its remote ID.
@@ 288-297 (lines=10) @@
285
     *
286
     * @return array
287
     */
288
    public function loadContentInfoByRemoteId($remoteId)
289
    {
290
        try {
291
            return $this->innerGateway->loadContentInfoByRemoteId($remoteId);
292
        } catch (DBALException $e) {
293
            throw new \RuntimeException('Database error', 0, $e);
294
        } catch (\PDOException $e) {
295
            throw new \RuntimeException('Database error', 0, $e);
296
        }
297
    }
298
299
    /**
300
     * Loads info for a content object identified by its location ID (node ID).
@@ 310-319 (lines=10) @@
307
     *
308
     * @return array
309
     */
310
    public function loadContentInfoByLocationId($locationId)
311
    {
312
        try {
313
            return $this->innerGateway->loadContentInfoByLocationId($locationId);
314
        } catch (DBALException $e) {
315
            throw new \RuntimeException('Database error', 0, $e);
316
        } catch (\PDOException $e) {
317
            throw new \RuntimeException('Database error', 0, $e);
318
        }
319
    }
320
321
    /**
322
     * Loads info for content identified by $contentId.
@@ 333-342 (lines=10) @@
330
     *
331
     * @return array
332
     */
333
    public function loadContentInfo($contentId)
334
    {
335
        try {
336
            return $this->innerGateway->loadContentInfo($contentId);
337
        } catch (DBALException $e) {
338
            throw new RuntimeException('Database error', 0, $e);
339
        } catch (PDOException $e) {
340
            throw new RuntimeException('Database error', 0, $e);
341
        }
342
    }
343
344
    public function loadContentInfoList(array $contentIds)
345
    {
@@ 344-353 (lines=10) @@
341
        }
342
    }
343
344
    public function loadContentInfoList(array $contentIds)
345
    {
346
        try {
347
            return $this->innerGateway->loadContentInfoList($contentIds);
348
        } catch (DBALException $e) {
349
            throw new RuntimeException('Database error', 0, $e);
350
        } catch (PDOException $e) {
351
            throw new RuntimeException('Database error', 0, $e);
352
        }
353
    }
354
355
    /**
356
     * Loads version info for content identified by $contentId and $versionNo.
@@ 367-376 (lines=10) @@
364
     *
365
     * @return array
366
     */
367
    public function loadVersionInfo($contentId, $versionNo)
368
    {
369
        try {
370
            return $this->innerGateway->loadVersionInfo($contentId, $versionNo);
371
        } catch (DBALException $e) {
372
            throw new RuntimeException('Database error', 0, $e);
373
        } catch (PDOException $e) {
374
            throw new RuntimeException('Database error', 0, $e);
375
        }
376
    }
377
378
    /**
379
     * Returns data for all versions with given status created by the given $userId.
@@ 386-395 (lines=10) @@
383
     *
384
     * @return string[][]
385
     */
386
    public function listVersionsForUser($userId, $status = VersionInfo::STATUS_DRAFT)
387
    {
388
        try {
389
            return $this->innerGateway->listVersionsForUser($userId, $status);
390
        } catch (DBALException $e) {
391
            throw new RuntimeException('Database error', 0, $e);
392
        } catch (PDOException $e) {
393
            throw new RuntimeException('Database error', 0, $e);
394
        }
395
    }
396
397
    /**
398
     * Returns all version data for the given $contentId.
@@ 426-435 (lines=10) @@
423
     *
424
     * @return int[]
425
     */
426
    public function listVersionNumbers($contentId)
427
    {
428
        try {
429
            return $this->innerGateway->listVersionNumbers($contentId);
430
        } catch (DBALException $e) {
431
            throw new RuntimeException('Database error', 0, $e);
432
        } catch (PDOException $e) {
433
            throw new RuntimeException('Database error', 0, $e);
434
        }
435
    }
436
437
    /**
438
     * Returns last version number for content identified by $contentId.
@@ 444-453 (lines=10) @@
441
     *
442
     * @return int
443
     */
444
    public function getLastVersionNumber($contentId)
445
    {
446
        try {
447
            return $this->innerGateway->getLastVersionNumber($contentId);
448
        } catch (DBALException $e) {
449
            throw new RuntimeException('Database error', 0, $e);
450
        } catch (PDOException $e) {
451
            throw new RuntimeException('Database error', 0, $e);
452
        }
453
    }
454
455
    /**
456
     * Returns all IDs for locations that refer to $contentId.
@@ 462-471 (lines=10) @@
459
     *
460
     * @return int[]
461
     */
462
    public function getAllLocationIds($contentId)
463
    {
464
        try {
465
            return $this->innerGateway->getAllLocationIds($contentId);
466
        } catch (DBALException $e) {
467
            throw new RuntimeException('Database error', 0, $e);
468
        } catch (PDOException $e) {
469
            throw new RuntimeException('Database error', 0, $e);
470
        }
471
    }
472
473
    /**
474
     * Returns all field IDs of $contentId grouped by their type.
@@ 484-493 (lines=10) @@
481
     *
482
     * @return int[][]
483
     */
484
    public function getFieldIdsByType($contentId, $versionNo = null, $languageCode = null)
485
    {
486
        try {
487
            return $this->innerGateway->getFieldIdsByType($contentId, $versionNo, $languageCode);
488
        } catch (DBALException $e) {
489
            throw new RuntimeException('Database error', 0, $e);
490
        } catch (PDOException $e) {
491
            throw new RuntimeException('Database error', 0, $e);
492
        }
493
    }
494
495
    /**
496
     * Deletes relations to and from $contentId.
@@ 502-511 (lines=10) @@
499
     * @param int $contentId
500
     * @param int|null $versionNo
501
     */
502
    public function deleteRelations($contentId, $versionNo = null)
503
    {
504
        try {
505
            return $this->innerGateway->deleteRelations($contentId, $versionNo);
506
        } catch (DBALException $e) {
507
            throw new RuntimeException('Database error', 0, $e);
508
        } catch (PDOException $e) {
509
            throw new RuntimeException('Database error', 0, $e);
510
        }
511
    }
512
513
    /**
514
     * Removes relations to Content with $contentId from Relation and RelationList field type fields.
@@ 518-527 (lines=10) @@
515
     *
516
     * @param int $contentId
517
     */
518
    public function removeReverseFieldRelations($contentId)
519
    {
520
        try {
521
            return $this->innerGateway->removeReverseFieldRelations($contentId);
522
        } catch (DBALException $e) {
523
            throw new RuntimeException('Database error', 0, $e);
524
        } catch (PDOException $e) {
525
            throw new RuntimeException('Database error', 0, $e);
526
        }
527
    }
528
529
    /**
530
     * Deletes the field with the given $fieldId.
@@ 534-543 (lines=10) @@
531
     *
532
     * @param int $fieldId
533
     */
534
    public function deleteField($fieldId)
535
    {
536
        try {
537
            return $this->innerGateway->deleteField($fieldId);
538
        } catch (DBALException $e) {
539
            throw new RuntimeException('Database error', 0, $e);
540
        } catch (PDOException $e) {
541
            throw new RuntimeException('Database error', 0, $e);
542
        }
543
    }
544
545
    /**
546
     * Deletes all fields of $contentId in all versions.
@@ 552-561 (lines=10) @@
549
     * @param int $contentId
550
     * @param int|null $versionNo
551
     */
552
    public function deleteFields($contentId, $versionNo = null)
553
    {
554
        try {
555
            return $this->innerGateway->deleteFields($contentId, $versionNo);
556
        } catch (DBALException $e) {
557
            throw new RuntimeException('Database error', 0, $e);
558
        } catch (PDOException $e) {
559
            throw new RuntimeException('Database error', 0, $e);
560
        }
561
    }
562
563
    /**
564
     * Deletes all versions of $contentId.
@@ 570-579 (lines=10) @@
567
     * @param int $contentId
568
     * @param int|null $versionNo
569
     */
570
    public function deleteVersions($contentId, $versionNo = null)
571
    {
572
        try {
573
            return $this->innerGateway->deleteVersions($contentId, $versionNo);
574
        } catch (DBALException $e) {
575
            throw new RuntimeException('Database error', 0, $e);
576
        } catch (PDOException $e) {
577
            throw new RuntimeException('Database error', 0, $e);
578
        }
579
    }
580
581
    /**
582
     * Deletes all names of $contentId.
@@ 588-597 (lines=10) @@
585
     * @param int $contentId
586
     * @param int|null $versionNo
587
     */
588
    public function deleteNames($contentId, $versionNo = null)
589
    {
590
        try {
591
            return $this->innerGateway->deleteNames($contentId, $versionNo);
592
        } catch (DBALException $e) {
593
            throw new RuntimeException('Database error', 0, $e);
594
        } catch (PDOException $e) {
595
            throw new RuntimeException('Database error', 0, $e);
596
        }
597
    }
598
599
    /**
600
     * Sets the content object name.
@@ 607-616 (lines=10) @@
604
     * @param string $name
605
     * @param string $language
606
     */
607
    public function setName($contentId, $version, $name, $language)
608
    {
609
        try {
610
            return $this->innerGateway->setName($contentId, $version, $name, $language);
611
        } catch (DBALException $e) {
612
            throw new RuntimeException('Database error', 0, $e);
613
        } catch (PDOException $e) {
614
            throw new RuntimeException('Database error', 0, $e);
615
        }
616
    }
617
618
    /**
619
     * Deletes the actual content object referred to by $contentId.
@@ 623-632 (lines=10) @@
620
     *
621
     * @param int $contentId
622
     */
623
    public function deleteContent($contentId)
624
    {
625
        try {
626
            return $this->innerGateway->deleteContent($contentId);
627
        } catch (DBALException $e) {
628
            throw new RuntimeException('Database error', 0, $e);
629
        } catch (PDOException $e) {
630
            throw new RuntimeException('Database error', 0, $e);
631
        }
632
    }
633
634
    /**
635
     * Loads data of related to/from $contentId.
@@ 643-652 (lines=10) @@
640
     *
641
     * @return mixed[][] Content data, array structured like {@see \eZ\Publish\Core\Persistence\Legacy\Content\Gateway::load()}
642
     */
643
    public function loadRelations($contentId, $contentVersionNo = null, $relationType = null)
644
    {
645
        try {
646
            return $this->innerGateway->loadRelations($contentId, $contentVersionNo, $relationType);
647
        } catch (DBALException $e) {
648
            throw new RuntimeException('Database error', 0, $e);
649
        } catch (PDOException $e) {
650
            throw new RuntimeException('Database error', 0, $e);
651
        }
652
    }
653
654
    /**
655
     * Loads data of related to/from $contentId.
@@ 664-673 (lines=10) @@
661
     *
662
     * @return mixed[][] Content data, array structured like {@see \eZ\Publish\Core\Persistence\Legacy\Content\Gateway::load()}
663
     */
664
    public function loadReverseRelations($contentId, $relationType = null)
665
    {
666
        try {
667
            return $this->innerGateway->loadReverseRelations($contentId, $relationType);
668
        } catch (DBALException $e) {
669
            throw new RuntimeException('Database error', 0, $e);
670
        } catch (PDOException $e) {
671
            throw new RuntimeException('Database error', 0, $e);
672
        }
673
    }
674
675
    /**
676
     * Deletes the relation with the given $relationId.
@@ 684-693 (lines=10) @@
681
     *                 \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
682
     *                 \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
683
     */
684
    public function deleteRelation($relationId, $type)
685
    {
686
        try {
687
            return $this->innerGateway->deleteRelation($relationId, $type);
688
        } catch (DBALException $e) {
689
            throw new RuntimeException('Database error', 0, $e);
690
        } catch (PDOException $e) {
691
            throw new RuntimeException('Database error', 0, $e);
692
        }
693
    }
694
695
    /**
696
     * Inserts a new relation database record.
@@ 702-711 (lines=10) @@
699
     *
700
     * @return int ID the inserted ID
701
     */
702
    public function insertRelation(RelationCreateStruct $struct)
703
    {
704
        try {
705
            return $this->innerGateway->insertRelation($struct);
706
        } catch (DBALException $e) {
707
            throw new RuntimeException('Database error', 0, $e);
708
        } catch (PDOException $e) {
709
            throw new RuntimeException('Database error', 0, $e);
710
        }
711
    }
712
713
    /**
714
     * Returns all Content IDs for a given $contentTypeId.
@@ 720-729 (lines=10) @@
717
     *
718
     * @return int[]
719
     */
720
    public function getContentIdsByContentTypeId($contentTypeId)
721
    {
722
        try {
723
            return $this->innerGateway->getContentIdsByContentTypeId($contentTypeId);
724
        } catch (DBALException $e) {
725
            throw new RuntimeException('Database error', 0, $e);
726
        } catch (PDOException $e) {
727
            throw new RuntimeException('Database error', 0, $e);
728
        }
729
    }
730
731
    /**
732
     * Load name data for set of content id's and corresponding version number.
@@ 738-747 (lines=10) @@
735
     *
736
     * @return array
737
     */
738
    public function loadVersionedNameData($rows)
739
    {
740
        try {
741
            return $this->innerGateway->loadVersionedNameData($rows);
742
        } catch (DBALException $e) {
743
            throw new RuntimeException('Database error', 0, $e);
744
        } catch (PDOException $e) {
745
            throw new RuntimeException('Database error', 0, $e);
746
        }
747
    }
748
749
    /**
750
     * Batch method for copying all relation meta data for copied Content object.
@@ 758-767 (lines=10) @@
755
     * @param int $copiedContentId
756
     * @param int|null $versionNo If specified only copy for a given version number, otherwise all.
757
     */
758
    public function copyRelations($originalContentId, $copiedContentId, $versionNo = null)
759
    {
760
        try {
761
            return $this->innerGateway->copyRelations($originalContentId, $copiedContentId, $versionNo);
762
        } catch (DBALException $e) {
763
            throw new RuntimeException('Database error', 0, $e);
764
        } catch (PDOException $e) {
765
            throw new RuntimeException('Database error', 0, $e);
766
        }
767
    }
768
769
    /**
770
     * Remove the specified translation from all the Versions of a Content Object.
@@ 775-784 (lines=10) @@
772
     * @param int $contentId
773
     * @param string $languageCode language code of the translation
774
     */
775
    public function deleteTranslationFromContent($contentId, $languageCode)
776
    {
777
        try {
778
            return $this->innerGateway->deleteTranslationFromContent($contentId, $languageCode);
779
        } catch (DBALException $e) {
780
            throw new RuntimeException('Database error', 0, $e);
781
        } catch (PDOException $e) {
782
            throw new RuntimeException('Database error', 0, $e);
783
        }
784
    }
785
786
    /**
787
     * Delete Content fields (attributes) for the given Translation.
@@ 794-803 (lines=10) @@
791
     * @param int $contentId
792
     * @param int $versionNo (optional) filter by versionNo
793
     */
794
    public function deleteTranslatedFields($languageCode, $contentId, $versionNo = null)
795
    {
796
        try {
797
            return $this->innerGateway->deleteTranslatedFields($languageCode, $contentId, $versionNo);
798
        } catch (DBALException $e) {
799
            throw new RuntimeException('Database error', 0, $e);
800
        } catch (PDOException $e) {
801
            throw new RuntimeException('Database error', 0, $e);
802
        }
803
    }
804
805
    /**
806
     * Delete the specified Translation from the given Version.
@@ 812-821 (lines=10) @@
809
     * @param int $versionNo
810
     * @param string $languageCode
811
     */
812
    public function deleteTranslationFromVersion($contentId, $versionNo, $languageCode)
813
    {
814
        try {
815
            return $this->innerGateway->deleteTranslationFromVersion($contentId, $versionNo, $languageCode);
816
        } catch (DBALException $e) {
817
            throw new RuntimeException('Database error', 0, $e);
818
        } catch (PDOException $e) {
819
            throw new RuntimeException('Database error', 0, $e);
820
        }
821
    }
822
}
823