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

Persistence/Legacy/Notification/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\Notification\Gateway;
10
11 use Doctrine\DBAL\DBALException;
12 use eZ\Publish\Core\Base\Exceptions\DatabaseException;
13 use eZ\Publish\Core\Persistence\Legacy\Notification\Gateway;
14 use eZ\Publish\SPI\Persistence\Notification\CreateStruct;
15 use eZ\Publish\SPI\Persistence\Notification\Notification;
16 use PDOException;
17
18 class ExceptionConversion extends Gateway
19 {
25 protected $innerGateway;
26
32 public function __construct(Gateway $innerGateway)
33 {
34 $this->innerGateway = $innerGateway;
35 }
36
37 public function getNotificationById(int $notificationId): array
38 {
39 try {
40 return $this->innerGateway->getNotificationById($notificationId);
41 } catch (DBALException | PDOException $e) {
42 throw DatabaseException::wrap($e);
43 }
44 }
45
46 public function updateNotification(Notification $notification): void
47 {
48 try {
49 $this->innerGateway->updateNotification($notification);
50 } catch (DBALException | PDOException $e) {
51 throw DatabaseException::wrap($e);
52 }
53 }
54
55 public function countUserNotifications(int $userId): int
56 {
57 try {
58 return $this->innerGateway->countUserNotifications($userId);
59 } catch (DBALException | PDOException $e) {
60 throw DatabaseException::wrap($e);
61 }
62 }
63
64 public function countUserPendingNotifications(int $userId): int
65 {
66 try {
67 return $this->innerGateway->countUserPendingNotifications($userId);
68 } catch (DBALException | PDOException $e) {
69 throw DatabaseException::wrap($e);
70 }
71 }
72
73 public function loadUserNotifications(int $userId, int $offset = 0, int $limit = -1): array
74 {
75 try {
76 return $this->innerGateway->loadUserNotifications($userId, $offset, $limit);
77 } catch (DBALException | PDOException $e) {
78 throw DatabaseException::wrap($e);
79 }
80 }
81
82 public function insert(CreateStruct $notification): int
83 {
84 try {
85 return $this->innerGateway->insert($notification);
86 } catch (DBALException | PDOException $e) {
87 throw DatabaseException::wrap($e);
88 }
89 }
90
91 public function delete(int $notificationId): void
92 {
93 try {
94 $this->innerGateway->delete($notificationId);
95 } catch (DBALException | PDOException $e) {
96 throw DatabaseException::wrap($e);
97 }
98 }
99 }
eZ\Publish\Core\Base\Exceptions\DatabaseException
An exception that is thrown when the database encounters an error.
Definition: DatabaseException.php:18
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:19
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\updateNotification
updateNotification(Notification $notification)
Update Notification ValueObject in persistent storage.
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:46
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\getNotificationById
getNotificationById(int $notificationId)
Get Notification by its id.
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:37
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\$innerGateway
$innerGateway
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:25
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\countUserNotifications
countUserNotifications(int $userId)
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:55
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\__construct
__construct(Gateway $innerGateway)
ExceptionConversion constructor.
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:32
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\countUserPendingNotifications
countUserPendingNotifications(int $userId)
Count users unread Notifications.
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:64
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\loadUserNotifications
loadUserNotifications(int $userId, int $offset=0, int $limit=-1)
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:73
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway\ExceptionConversion\insert
insert(CreateStruct $notification)
Store Notification ValueObject in persistent storage.
Definition: Persistence/Legacy/Notification/Gateway/ExceptionConversion.php:82
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway
Definition: Persistence/Legacy/Notification/Gateway.php:15
eZ\Publish\SPI\Persistence\Notification\CreateStruct
Definition: SPI/Persistence/Notification/CreateStruct.php:14
eZ\Publish\SPI\Persistence\Notification\Notification
Definition: SPI/Persistence/Notification/Notification.php:14
eZ\Publish\Core\Persistence\Legacy\Notification\Gateway
Definition: Persistence/Legacy/Notification/Gateway/DoctrineDatabase.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.