-
- if (empty($tags)) {
- return;
- }
-
- $this->getDoctrine()
- ->getRepository('WallabagCoreBundle:Entry')
- ->removeTags($userId, $tags);
-
- // cleanup orphan tags
- $em = $this->getDoctrine()->getManager();
-
- foreach ($tags as $tag) {
- if (count($tag->getEntries()) === 0) {
- $em->remove($tag);
- }
- }
-
- $em->flush();