- * @todo move that in a more global place
- */
- private function assignTagsToEntry(Entry $entry, $tags)
- {
- foreach ($tags as $tag) {
- $label = trim($tag['tag']);
- $tagEntity = $this->em
- ->getRepository('WallabagCoreBundle:Tag')
- ->findOneByLabelAndUserId($label, $this->user->getId());
-
- if (is_object($tagEntity)) {
- $entry->addTag($tagEntity);
- } else {
- $newTag = new Tag($this->user);
- $newTag->setLabel($label);
- $entry->addTag($newTag);
- }
- $this->em->flush();
- }
- }
-
- /**
- * @see https://getpocket.com/developer/docs/v3/retrieve