Code Duplication    Length = 10-10 lines in 14 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/User/Gateway/ExceptionConversion.php 1 location

@@ 116-125 (lines=10) @@
113
     *
114
     * @return array
115
     */
116
    public function loadByEmail($email)
117
    {
118
        try {
119
            return $this->innerGateway->loadByEmail($email);
120
        } catch (\DBALException $e) {
121
            throw new \RuntimeException('Database error', 0, $e);
122
        } catch (\PDOException $e) {
123
            throw new \RuntimeException('Database error', 0, $e);
124
        }
125
    }
126
127
    /**
128
     * Update the user information specified by the user struct.

eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/Gateway/ExceptionConversion.php 5 locations

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

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

@@ 375-384 (lines=10) @@
372
     *
373
     * @return string[][]
374
     */
375
    public function listVersions($contentId, $status = null, $limit = -1)
376
    {
377
        try {
378
            return $this->innerGateway->listVersions($contentId, $status, $limit);
379
        } catch (DBALException $e) {
380
            throw new RuntimeException('Database error', 0, $e);
381
        } catch (PDOException $e) {
382
            throw new RuntimeException('Database error', 0, $e);
383
        }
384
    }
385
386
    /**
387
     * Returns all version numbers for the given $contentId.
@@ 451-460 (lines=10) @@
448
     *
449
     * @return int[][]
450
     */
451
    public function getFieldIdsByType($contentId, $versionNo = null, $languageCode = null)
452
    {
453
        try {
454
            return $this->innerGateway->getFieldIdsByType($contentId, $versionNo, $languageCode);
455
        } catch (DBALException $e) {
456
            throw new RuntimeException('Database error', 0, $e);
457
        } catch (PDOException $e) {
458
            throw new RuntimeException('Database error', 0, $e);
459
        }
460
    }
461
462
    /**
463
     * Deletes relations to and from $contentId.
@@ 725-734 (lines=10) @@
722
     * @param int $copiedContentId
723
     * @param int|null $versionNo If specified only copy for a given version number, otherwise all.
724
     */
725
    public function copyRelations($originalContentId, $copiedContentId, $versionNo = null)
726
    {
727
        try {
728
            return $this->innerGateway->copyRelations($originalContentId, $copiedContentId, $versionNo);
729
        } catch (DBALException $e) {
730
            throw new RuntimeException('Database error', 0, $e);
731
        } catch (PDOException $e) {
732
            throw new RuntimeException('Database error', 0, $e);
733
        }
734
    }
735
736
    /**
737
     * Remove the specified translation from all the Versions of a Content Object.
@@ 742-751 (lines=10) @@
739
     * @param int $contentId
740
     * @param string $languageCode language code of the translation
741
     */
742
    public function removeTranslationFromContent($contentId, $languageCode)
743
    {
744
        try {
745
            return $this->innerGateway->removeTranslationFromContent($contentId, $languageCode);
746
        } catch (DBALException $e) {
747
            throw new RuntimeException('Database error', 0, $e);
748
        } catch (PDOException $e) {
749
            throw new RuntimeException('Database error', 0, $e);
750
        }
751
    }
752
753
    /**
754
     * Delete the specified Translation from the given Version.
@@ 760-769 (lines=10) @@
757
     * @param int $versionNo
758
     * @param string $languageCode
759
     */
760
    public function deleteTranslationFromVersion($contentId, $versionNo, $languageCode)
761
    {
762
        try {
763
            return $this->innerGateway->deleteTranslationFromVersion($contentId, $versionNo, $languageCode);
764
        } catch (DBALException $e) {
765
            throw new RuntimeException('Database error', 0, $e);
766
        } catch (PDOException $e) {
767
            throw new RuntimeException('Database error', 0, $e);
768
        }
769
    }
770
771
    /**
772
     * Delete Content fields (attributes) for the given Translation.
@@ 779-788 (lines=10) @@
776
     * @param int $contentId
777
     * @param int $versionNo (optional) filter by versionNo
778
     */
779
    public function deleteTranslatedFields($languageCode, $contentId, $versionNo = null)
780
    {
781
        try {
782
            return $this->innerGateway->deleteTranslatedFields($languageCode, $contentId, $versionNo);
783
        } catch (DBALException $e) {
784
            throw new RuntimeException('Database error', 0, $e);
785
        } catch (PDOException $e) {
786
            throw new RuntimeException('Database error', 0, $e);
787
        }
788
    }
789
}
790