/**
  * Rollback transaction
  *
  * Rollback transaction, or throw exceptions if no transactions has been started.
  *
  * @throws \RuntimeException If no transaction has been started
  */
 public function rollback()
 {
     if (0 === $this->transactionDepth) {
         throw new \RuntimeException('What error code should be used?');
     }
     if ($this->contentService) {
         $this->contentService->rollback();
     }
     if ($this->contentTypeService) {
         $this->contentTypeService->rollback();
     }
     if ($this->languageService) {
         $this->languageService->rollback();
     }
     if ($this->locationService) {
         $this->locationService->rollback();
     }
     if ($this->roleService) {
         $this->roleService->rollback();
     }
     if ($this->sectionService) {
         $this->sectionService->rollback();
     }
     if ($this->trashService) {
         $this->trashService->rollback();
     }
     if ($this->userService) {
         $this->userService->rollback();
     }
     --$this->transactionDepth;
 }
 /**
  * Recovers the $trashedLocation at its original place if possible.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to recover the trash item at the parent location location
  *
  * If $newParentLocation is provided, $trashedLocation will be restored under it.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\TrashItem $trashItem
  * @param \eZ\Publish\API\Repository\Values\Content\Location $newParentLocation
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Location the newly created or recovered location
  */
 public function recover(TrashItem $trashItem, Location $newParentLocation = null)
 {
     if (false === $this->repository->canUser('content', 'edit', $trashItem)) {
         throw new UnauthorizedExceptionStub('What error code should be used?');
     }
     $location = $this->locationService->recoverLocation($trashItem->location, $newParentLocation);
     unset($this->trashItems[$trashItem->id], $this->locations[$trashItem->id]);
     return $location;
 }