@@ 86-97 (lines=12) @@ | ||
83 | * |
|
84 | * @return \eZ\Publish\Core\REST\Common\Value |
|
85 | */ |
|
86 | public function deleteBookmark(Request $request, int $locationId): RestValue |
|
87 | { |
|
88 | $location = $this->locationService->loadLocation($locationId); |
|
89 | ||
90 | try { |
|
91 | $this->bookmarkService->deleteBookmark($location); |
|
92 | ||
93 | return new Values\NoContent(); |
|
94 | } catch (InvalidArgumentException $e) { |
|
95 | throw new Exceptions\NotFoundException("Location {$locationId} is not bookmarked"); |
|
96 | } |
|
97 | } |
|
98 | ||
99 | /** |
|
100 | * Checks if given location is bookmarked. |
|
@@ 110-119 (lines=10) @@ | ||
107 | * |
|
108 | * @return \eZ\Publish\Core\REST\Server\Values\OK |
|
109 | */ |
|
110 | public function isBookmarked(Request $request, int $locationId): Values\OK |
|
111 | { |
|
112 | $location = $this->locationService->loadLocation($locationId); |
|
113 | ||
114 | if (!$this->bookmarkService->isBookmarked($location)) { |
|
115 | throw new Exceptions\NotFoundException("Location {$locationId} is not bookmarked"); |
|
116 | } |
|
117 | ||
118 | return new Values\OK(); |
|
119 | } |
|
120 | ||
121 | /** |
|
122 | * List bookmarked locations. |