Improved message when renaming tag to existing one

This commit is contained in:
Marcin Kurczewski 2014-10-18 14:29:26 +02:00
parent 4db5bd8007
commit e6fc010897

View file

@ -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);
} }