| @@ 140-156 (lines=17) @@ | ||
| 137 | * |
|
| 138 | * @param \eZ\Publish\API\Repository\Values\Content\UrlWildcard $urlWildcard the url wildcard to remove |
|
| 139 | */ |
|
| 140 | public function remove(URLWildcard $urlWildcard) |
|
| 141 | { |
|
| 142 | if ($this->repository->hasAccess('content', 'urltranslator') !== true) { |
|
| 143 | throw new UnauthorizedException('content', 'urltranslator'); |
|
| 144 | } |
|
| 145 | ||
| 146 | $this->repository->beginTransaction(); |
|
| 147 | try { |
|
| 148 | $this->urlWildcardHandler->remove( |
|
| 149 | $urlWildcard->id |
|
| 150 | ); |
|
| 151 | $this->repository->commit(); |
|
| 152 | } catch (Exception $e) { |
|
| 153 | $this->repository->rollback(); |
|
| 154 | throw $e; |
|
| 155 | } |
|
| 156 | } |
|
| 157 | ||
| 158 | /** |
|
| 159 | * Loads a url wild card. |
|
| @@ 221-236 (lines=16) @@ | ||
| 218 | * |
|
| 219 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to empty the trash |
|
| 220 | */ |
|
| 221 | public function emptyTrash() |
|
| 222 | { |
|
| 223 | if ($this->repository->hasAccess('content', 'cleantrash') !== true) { |
|
| 224 | throw new UnauthorizedException('content', 'cleantrash'); |
|
| 225 | } |
|
| 226 | ||
| 227 | $this->repository->beginTransaction(); |
|
| 228 | try { |
|
| 229 | // Persistence layer takes care of deleting content objects |
|
| 230 | $this->persistenceHandler->trashHandler()->emptyTrash(); |
|
| 231 | $this->repository->commit(); |
|
| 232 | } catch (Exception $e) { |
|
| 233 | $this->repository->rollback(); |
|
| 234 | throw $e; |
|
| 235 | } |
|
| 236 | } |
|
| 237 | ||
| 238 | /** |
|
| 239 | * Deletes a trash item. |
|