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

Core/Persistence/Legacy/Bookmark/Handler.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;
10
11 use eZ\Publish\SPI\Persistence\Bookmark\Bookmark;
12 use eZ\Publish\SPI\Persistence\Bookmark\CreateStruct;
13 use eZ\Publish\SPI\Persistence\Bookmark\Handler as HandlerInterface;
14
18 class Handler implements HandlerInterface
19 {
21 private $gateway;
22
24 private $mapper;
25
32 public function __construct(Gateway $gateway, Mapper $mapper)
33 {
34 $this->gateway = $gateway;
35 $this->mapper = $mapper;
36 }
37
41 public function create(CreateStruct $createStruct): Bookmark
42 {
43 $bookmark = $this->mapper->createBookmarkFromCreateStruct(
44 $createStruct
45 );
46 $bookmark->id = $this->gateway->insertBookmark($bookmark);
47
48 return $bookmark;
49 }
50
54 public function delete(int $bookmarkId): void
55 {
56 $this->gateway->deleteBookmark($bookmarkId);
57 }
58
62 public function loadByUserIdAndLocationId(int $userId, array $locationIds): array
63 {
64 $bookmarks = $this->mapper->extractBookmarksFromRows(
65 $this->gateway->loadBookmarkDataByUserIdAndLocationId($userId, $locationIds)
66 );
67
68 $list = [];
69 foreach ($bookmarks as $bookmark) {
70 $list[$bookmark->locationId] = $bookmark;
71 }
72
73 return $list;
74 }
75
79 public function loadUserBookmarks(int $userId, int $offset = 0, int $limit = -1): array
80 {
81 return $this->mapper->extractBookmarksFromRows(
82 $this->gateway->loadUserBookmarks($userId, $offset, $limit)
83 );
84 }
85
89 public function countUserBookmarks(int $userId): int
90 {
91 return $this->gateway->countUserBookmarks($userId);
92 }
93
97 public function locationSwapped(int $location1Id, int $location2Id): void
98 {
99 $this->gateway->locationSwapped($location1Id, $location2Id);
100 }
101 }
eZ\Publish\Core\Persistence\Legacy\Bookmark\Gateway
Base class for bookmark gateways.
Definition: Persistence/Legacy/Bookmark/Gateway.php:17
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler
Storage Engine handler for bookmarks.
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:19
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\loadUserBookmarks
loadUserBookmarks(int $userId, int $offset=0, int $limit=-1)
{Loads bookmarks owned by user.the start offset for paging the number of bookmarked locations returne...
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:79
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\$mapper
$mapper
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:24
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\$gateway
$gateway
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:21
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\countUserBookmarks
countUserBookmarks(int $userId)
{Count bookmarks owned by user.int}
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:89
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\locationSwapped
locationSwapped(int $location1Id, int $location2Id)
{Notifies the underlying engine that a location was swapped.This method triggers the change of the bo...
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:97
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\create
create(CreateStruct $createStruct)
{Create a new bookmark.\eZ\Publish\SPI\Persistence\Bookmark\Bookmark}
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:41
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\loadByUserIdAndLocationId
loadByUserIdAndLocationId(int $userId, array $locationIds)
{Get bookmark by user id and location id.\eZ\Publish\SPI\Persistence\Bookmark\Bookmark[]}
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:62
eZ\Publish\Core\Persistence\Legacy\Bookmark\Handler\__construct
__construct(Gateway $gateway, Mapper $mapper)
Handler constructor.
Definition: Core/Persistence/Legacy/Bookmark/Handler.php:32
eZ\Publish\Core\Persistence\Legacy\Bookmark\Mapper
Bookmark mapper.
Definition: Publish/Core/Persistence/Legacy/Bookmark/Mapper.php:18
eZ\Publish\SPI\Persistence\Bookmark\Bookmark
Definition: SPI/Persistence/Bookmark/Bookmark.php:14
eZ\Publish\SPI\Persistence\Bookmark\CreateStruct
Definition: SPI/Persistence/Bookmark/CreateStruct.php:14
eZ\Publish\SPI\Persistence\Bookmark\Handler
Definition: SPI/Persistence/Bookmark/Handler.php:12
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.