Improved message when renaming tag to existing one
This commit is contained in:
parent
4db5bd8007
commit
e6fc010897
1 changed files with 3 additions and 0 deletions
|
@ -173,6 +173,9 @@ class TagService
|
||||||
|
|
||||||
private function updateTagName(Tag $tag, $newName)
|
private function updateTagName(Tag $tag, $newName)
|
||||||
{
|
{
|
||||||
|
$otherTag = $this->tagDao->findByName($newName);
|
||||||
|
if ($otherTag and $otherTag->getId() !== $tag->getId())
|
||||||
|
throw new \DomainException('Tag with this name already exists.');
|
||||||
$tag->setName($newName);
|
$tag->setName($newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue