mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 01:33:11 +08:00
Improved public API in Tag entity, avoiding anemic model
This commit is contained in:
@@ -22,7 +22,7 @@ trait TagManagerTrait
|
||||
$entities = [];
|
||||
foreach ($tags as $tagName) {
|
||||
$tagName = $this->normalizeTagName($tagName);
|
||||
$tag = $em->getRepository(Tag::class)->findOneBy(['name' => $tagName]) ?: (new Tag())->setName($tagName);
|
||||
$tag = $em->getRepository(Tag::class)->findOneBy(['name' => $tagName]) ?: new Tag($tagName);
|
||||
$em->persist($tag);
|
||||
$entities[] = $tag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user