forked from wallabag/wallabag
Fix duplicate tags creation when assigning search results to tag
Fixes #6330
This commit is contained in:
@ -247,11 +247,16 @@ class TagController extends AbstractController
|
||||
$filter
|
||||
);
|
||||
|
||||
$this->entityManager->persist($entry);
|
||||
// check to avoid duplicate tags creation
|
||||
foreach ($this->entityManager->getUnitOfWork()->getScheduledEntityInsertions() as $entity) {
|
||||
if ($entity instanceof Tag && strtolower($entity->getLabel()) === strtolower($filter)) {
|
||||
continue 2;
|
||||
}
|
||||
$this->entityManager->persist($entry);
|
||||
}
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->redirect($this->redirectHelper->to($request->headers->get('referer'), '', true));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user