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

Persistence/Legacy/Bookmark/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\Bookmark\Gateway;
10
11 use Doctrine\DBAL\DBALException;
12 use eZ\Publish\Core\Base\Exceptions\DatabaseException;
13 use eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway;
14 use eZ\Publish\SPI\Persistence\Bookmark\Bookmark;
15 use PDOException;
16
17 class ExceptionConversion extends Gateway
18 {
22 protected $innerGateway;
23
27 public function __construct(Gateway $innerGateway)
28 {
29 $this->innerGateway = $innerGateway;
30 }
31
32 public function insertBookmark(Bookmark $bookmark): int
33 {
34 try {
35 return $this->innerGateway->insertBookmark($bookmark);
36 } catch (DBALException | PDOException $e) {
37 throw DatabaseException::wrap($e);
38 }
39 }
40
41 public function deleteBookmark(int $id): void
42 {
43 try {
44 $this->innerGateway->deleteBookmark($id);
45 } catch (DBALException | PDOException $e) {
46 throw DatabaseException::wrap($e);
47 }
48 }
49
50 public function loadBookmarkDataByUserIdAndLocationId(int $userId, array $locationId): array
51 {
52 try {
53 return $this->innerGateway->loadBookmarkDataByUserIdAndLocationId($userId, $locationId);
54 } catch (DBALException | PDOException $e) {
55 throw DatabaseException::wrap($e);
56 }
57 }
58
59 public function loadUserBookmarks(int $userId, int $offset = 0, int $limit = -1): array
60 {
61 try {
62 return $this->innerGateway->loadUserBookmarks($userId, $offset, $limit);
63 } catch (DBALException | PDOException $e) {
64 throw DatabaseException::wrap($e);
65 }
66 }
67
68 public function countUserBookmarks(int $userId): int
69 {
70 try {
71 return $this->innerGateway->countUserBookmarks($userId);
72 } catch (DBALException | PDOException $e) {
73 throw DatabaseException::wrap($e);
74 }
75 }
76
77 public function locationSwapped(int $location1Id, int $location2Id): void
78 {
79 try {
80 $this->innerGateway->locationSwapped($location1Id, $location2Id);
81 } catch (DBALException | PDOException $e) {
82 throw DatabaseException::wrap($e);
83 }
84 }
85 }
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\Bookmark\Gateway\ExceptionConversion
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:18
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\insertBookmark
insertBookmark(Bookmark $bookmark)
Insert a bookmark.
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:32
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\$innerGateway
$innerGateway
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:22
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\__construct
__construct(Gateway $innerGateway)
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:27
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\locationSwapped
locationSwapped(int $location1Id, int $location2Id)
Updates related bookmarks when location was swapped.
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:77
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\loadBookmarkDataByUserIdAndLocationId
loadBookmarkDataByUserIdAndLocationId(int $userId, array $locationId)
Load data for an bookmark with the given $userId and $locationId.
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:50
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\countUserBookmarks
countUserBookmarks(int $userId)
Count bookmarks owned by given $userId.
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:68
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\deleteBookmark
deleteBookmark(int $id)
Delete bookmark with the given $id.
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:41
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway\ExceptionConversion\loadUserBookmarks
loadUserBookmarks(int $userId, int $offset=0, int $limit=-1)
Load data for all bookmarks owned by given $userId.
Definition: Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php:59
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway
Base class for bookmark gateways.
Definition: Persistence/Legacy/Bookmark/Gateway.php:17
eZ\Publish\SPI\Persistence\Bookmark\Bookmark
Definition: SPI/Persistence/Bookmark/Bookmark.php:14
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway
Definition: Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.