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

@@ 322-331 (lines=10) @@
319
        }
320
    }
321
322
    public function loadContentInfoList(array $contentIds)
323
    {
324
        try {
325
            return $this->innerGateway->loadContentInfoList($contentIds);
326
        } catch (DBALException $e) {
327
            throw new RuntimeException('Database error', 0, $e);
328
        } catch (PDOException $e) {
329
            throw new RuntimeException('Database error', 0, $e);
330
        }
331
    }
332
333
    /**
334
     * Loads version info for content identified by $contentId and $versionNo.
@@ 386-395 (lines=10) @@
383
     *
384
     * @return string[][]
385
     */
386
    public function listVersions($contentId, $status = null, $limit = -1)
387
    {
388
        try {
389
            return $this->innerGateway->listVersions($contentId, $status, $limit);
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 numbers for the given $contentId.
@@ 462-471 (lines=10) @@
459
     *
460
     * @return int[][]
461
     */
462
    public function getFieldIdsByType($contentId, $versionNo = null, $languageCode = null)
463
    {
464
        try {
465
            return $this->innerGateway->getFieldIdsByType($contentId, $versionNo, $languageCode);
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
     * Deletes relations to and from $contentId.
@@ 736-745 (lines=10) @@
733
     * @param int $copiedContentId
734
     * @param int|null $versionNo If specified only copy for a given version number, otherwise all.
735
     */
736
    public function copyRelations($originalContentId, $copiedContentId, $versionNo = null)
737
    {
738
        try {
739
            return $this->innerGateway->copyRelations($originalContentId, $copiedContentId, $versionNo);
740
        } catch (DBALException $e) {
741
            throw new RuntimeException('Database error', 0, $e);
742
        } catch (PDOException $e) {
743
            throw new RuntimeException('Database error', 0, $e);
744
        }
745
    }
746
747
    /**
748
     * Remove the specified translation from all the Versions of a Content Object.
@@ 772-781 (lines=10) @@
769
     * @param int $contentId
770
     * @param int $versionNo (optional) filter by versionNo
771
     */
772
    public function deleteTranslatedFields($languageCode, $contentId, $versionNo = null)
773
    {
774
        try {
775
            return $this->innerGateway->deleteTranslatedFields($languageCode, $contentId, $versionNo);
776
        } catch (DBALException $e) {
777
            throw new RuntimeException('Database error', 0, $e);
778
        } catch (PDOException $e) {
779
            throw new RuntimeException('Database error', 0, $e);
780
        }
781
    }
782
783
    /**
784
     * Delete the specified Translation from the given Version.
@@ 790-799 (lines=10) @@
787
     * @param int $versionNo
788
     * @param string $languageCode
789
     */
790
    public function deleteTranslationFromVersion($contentId, $versionNo, $languageCode)
791
    {
792
        try {
793
            return $this->innerGateway->deleteTranslationFromVersion($contentId, $versionNo, $languageCode);
794
        } catch (DBALException $e) {
795
            throw new RuntimeException('Database error', 0, $e);
796
        } catch (PDOException $e) {
797
            throw new RuntimeException('Database error', 0, $e);
798
        }
799
    }
800
}
801
@@ 753-762 (lines=10) @@
750
     * @param int $contentId
751
     * @param string $languageCode language code of the translation
752
     */
753
    public function deleteTranslationFromContent($contentId, $languageCode)
754
    {
755
        try {
756
            return $this->innerGateway->deleteTranslationFromContent($contentId, $languageCode);
757
        } catch (DBALException $e) {
758
            throw new RuntimeException('Database error', 0, $e);
759
        } catch (PDOException $e) {
760
            throw new RuntimeException('Database error', 0, $e);
761
        }
762
    }
763
764
    /**
765
     * Delete Content fields (attributes) for the given Translation.

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/Location/Gateway/ExceptionConversion.php 1 location

@@ 525-534 (lines=10) @@
522
     *
523
     * @return array
524
     */
525
    public function loadTrashByContent($contentId)
526
    {
527
        try {
528
            return $this->innerGateway->loadTrashByContent($contentId);
529
        } catch (DBALException $e) {
530
            throw new RuntimeException('Database error', 0, $e);
531
        } catch (PDOException $e) {
532
            throw new RuntimeException('Database error', 0, $e);
533
        }
534
    }
535
536
    /**
537
     * Removes every entries in the trash.