+ /**
+ * @param Entry $entry
+ * @param string $tags
+ */
+ private function assignTagsToEntry(Entry $entry, $tags)
+ {
+ foreach (explode(',', $tags) as $label) {
+ $label = trim($label);
+ $tagEntity = $this
+ ->getDoctrine()
+ ->getRepository('WallabagCoreBundle:Tag')
+ ->findOneByLabel($label);
+
+ if (is_null($tagEntity)) {
+ $tagEntity = new Tag($this->getUser());
+ $tagEntity->setLabel($label);
+ }
+
+ // only add the tag on the entry if the relation doesn't exist
+ if (!$entry->getTags()->contains($tagEntity)) {
+ $entry->addTag($tagEntity);
+ }
+ }
+ }
+
+ /**
+ * Retrieve salt for a giver user.
+ *
+ * @ApiDoc(
+ * parameters={
+ * {"name"="username", "dataType"="string", "required"=true, "description"="username"}
+ * }
+ * )
+ * @return array
+ */
+ public function getSaltAction($username)
+ {
+ $user = $this
+ ->getDoctrine()
+ ->getRepository('WallabagCoreBundle:User')
+ ->findOneByUsername($username);
+
+ if (is_null($user)) {
+ throw $this->createNotFoundException();
+ }
+
+ return array($user->getSalt() ?: null);
+ }