Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php
Go to the documentation of this file.
1 <?php
2
7 declare(strict_types=1);
8
9 namespace eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway;
10
11 use Doctrine\DBAL\DBALException;
12 use eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway;
13 use eZ\Publish\SPI\Persistence\UserPreference\UserPreferenceSetStruct;
14 use PDOException;
15 use RuntimeException;
16
17 class ExceptionConversion extends Gateway
18 {
24 protected $innerGateway;
25
31 public function __construct(Gateway $innerGateway)
32 {
33 $this->innerGateway = $innerGateway;
34 }
35
39 public function getUserPreferenceByUserIdAndName(int $userId, string $name): array
40 {
41 try {
42 return $this->innerGateway->getUserPreferenceByUserIdAndName($userId, $name);
43 } catch (DBALException | PDOException $e) {
44 throw new RuntimeException('Database error', 0, $e);
45 }
46 }
47
51 public function countUserPreferences(int $userId): int
52 {
53 try {
54 return $this->innerGateway->countUserPreferences($userId);
55 } catch (DBALException | PDOException $e) {
56 throw new RuntimeException('Database error', 0, $e);
57 }
58 }
59
63 public function loadUserPreferences(int $userId, int $offset = 0, int $limit = -1): array
64 {
65 try {
66 return $this->innerGateway->loadUserPreferences($userId, $offset, $limit);
67 } catch (DBALException | PDOException $e) {
68 throw new RuntimeException('Database error', 0, $e);
69 }
70 }
71
75 public function setUserPreference(UserPreferenceSetStruct $setStruct): int
76 {
77 try {
78 return $this->innerGateway->setUserPreference($setStruct);
79 } catch (DBALException | PDOException $e) {
80 throw new RuntimeException('Database error', 0, $e);
81 }
82 }
83 }
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway\ExceptionConversion
Definition: Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php:18
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway\ExceptionConversion\__construct
__construct(Gateway $innerGateway)
ExceptionConversion constructor.
Definition: Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php:31
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway\ExceptionConversion\setUserPreference
setUserPreference(UserPreferenceSetStruct $setStruct)
{Store UserPreference ValueObject in persistent storage.int}
Definition: Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php:75
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway\ExceptionConversion\getUserPreferenceByUserIdAndName
getUserPreferenceByUserIdAndName(int $userId, string $name)
{Get UserPreference by its user ID and name.array}
Definition: Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php:39
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway\ExceptionConversion\$innerGateway
$innerGateway
Definition: Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php:24
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway\ExceptionConversion\loadUserPreferences
loadUserPreferences(int $userId, int $offset=0, int $limit=-1)
{array}
Definition: Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php:63
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway\ExceptionConversion\countUserPreferences
countUserPreferences(int $userId)
{int}
Definition: Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php:51
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway
Definition: Persistence/Legacy/UserPreference/Gateway.php:14
eZ\Publish\SPI\Persistence\UserPreference\UserPreferenceSetStruct
Definition: SPI/Persistence/UserPreference/UserPreferenceSetStruct.php:14
eZ\Publish\Core\Persistence\Legacy\UserPreference\Gateway
Definition: Persistence/Legacy/UserPreference/Gateway/DoctrineDatabase.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.