/** * Deletes a tag. * * @param string $tagPath * * @return \eZ\Publish\Core\REST\Server\Values\NoContent */ public function deleteTag($tagPath) { $tag = $this->tagsService->loadTag($this->extractTagIdFromPath($tagPath)); $this->tagsService->deleteTag($tag); return new BaseValues\NoContent(); }
/** * Deletes $tag and all its descendants and synonyms. * * If $tag is a synonym, only the synonym is deleted * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user is not allowed to delete this tag * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the specified tag is not found * * @param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag $tag */ public function deleteTag(Tag $tag) { $this->service->deleteTag($tag); $this->signalDispatcher->emit(new DeleteTagSignal(array('tagId' => $tag->id))); }
/** * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException * * @covers \Netgen\TagsBundle\Core\Repository\TagsService::deleteTag */ public function testDeleteTagThrowsUnauthorizedExceptionForSynonym() { $this->repository->setCurrentUser($this->getStubbedUser(10)); $this->tagsService->deleteTag(new Tag(array('id' => 95))); }