Skip to content

Commit f208d3d

Browse files
committed
fixup! IBX-6773: Bookmarks for non-accessible contents cause exception - Added logger in BookmarkService
1 parent 2665578 commit f208d3d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

eZ/Publish/Core/Repository/BookmarkService.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
use eZ\Publish\SPI\Persistence\Bookmark\Handler as BookmarkHandler;
2222
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion;
2323
use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause;
24+
use Psr\Log\LoggerInterface;
25+
use Psr\Log\NullLogger;
2426

2527
class BookmarkService implements BookmarkServiceInterface
2628
{
@@ -30,16 +32,16 @@ class BookmarkService implements BookmarkServiceInterface
3032
/** @var \eZ\Publish\SPI\Persistence\Bookmark\Handler */
3133
protected $bookmarkHandler;
3234

35+
private LoggerInterface $logger;
36+
3337
/**
3438
* BookmarkService constructor.
35-
*
36-
* @param \eZ\Publish\API\Repository\Repository $repository
37-
* @param \eZ\Publish\SPI\Persistence\Bookmark\Handler $bookmarkHandler
3839
*/
39-
public function __construct(RepositoryInterface $repository, BookmarkHandler $bookmarkHandler)
40+
public function __construct(RepositoryInterface $repository, BookmarkHandler $bookmarkHandler, LoggerInterface $logger = null)
4041
{
4142
$this->repository = $repository;
4243
$this->bookmarkHandler = $bookmarkHandler;
44+
$this->logger = $logger ?? new NullLogger();
4345
}
4446

4547
/**
@@ -110,6 +112,8 @@ public function loadBookmarks(int $offset = 0, int $limit = 25): BookmarkList
110112

111113
$result = $this->repository->getlocationService()->find($filter, []);
112114
} catch (BadStateException $e) {
115+
$this->logger->debug($e);
116+
113117
return new BookmarkList();
114118
}
115119

eZ/Publish/Core/Repository/Repository.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ public function getBookmarkService(): BookmarkServiceInterface
599599
if ($this->bookmarkService === null) {
600600
$this->bookmarkService = new BookmarkService(
601601
$this,
602-
$this->persistenceHandler->bookmarkHandler()
602+
$this->persistenceHandler->bookmarkHandler(),
603+
$this->logger
603604
);
604605
}
605606

0 commit comments

Comments
 (0)