/**
  * 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;
 }
 /**
  * Deletes  a language from content repository
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
  *         if language can not be deleted
  *         because it is still assigned to some content / type / (...).
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If user does not have access to content translations
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Language $language
  */
 public function deleteLanguage(Language $language)
 {
     if (true !== $this->repository->hasAccess('content', 'translations')) {
         throw new UnauthorizedExceptionStub('What error code should be used?');
     }
     if (count($this->contentService->loadContentInfoByLanguageCode($language->languageCode))) {
         throw new InvalidArgumentExceptionStub('What error code should be used?');
     }
     unset($this->languages[$language->id], $this->codes[$language->languageCode]);
 }
 /**
  * Delete a Content Type object.
  *
  * Deletes a content type if it has no instances
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If there exist content objects of this type
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete a content type
  *
  * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType
  */
 public function deleteContentType(ContentType $contentType)
 {
     if (false === $this->repository->hasAccess('class', '*')) {
         throw new UnauthorizedExceptionStub('What error code should be used?');
     }
     if ($this->contentService->loadContentInfoByContentType($contentType)) {
         throw new BadStateExceptionStub('What error code should be used?');
     }
     unset($this->types[$contentType->id]);
 }