+ * @return ArrayCollection
+ */
+ public function getTags()
+ {
+ return $this->tags;
+ }
+
+ /**
+ * @VirtualProperty
+ * @SerializedName("tags")
+ * @Groups({"entries_for_user", "export_all"})
+ */
+ public function getSerializedTags()
+ {
+ $data = [];
+ foreach ($this->tags as $tag) {
+ $data[] = $tag->getLabel();
+ }
+
+ return $data;
+ }
+
+ /**
+ * @param Tag $tag
+ */
+ public function addTag(Tag $tag)
+ {
+ if ($this->tags->contains($tag)) {
+ return;
+ }
+
+ // check if tag already exist but has not yet be persisted
+ // it seems that the previous condition with `contains()` doesn't check that case
+ foreach ($this->tags as $existingTag) {
+ if ($existingTag->getLabel() === $tag->getLabel()) {
+ return;
+ }
+ }
+
+ $this->tags->add($tag);
+ $tag->addEntry($this);
+ }
+
+ /**
+ * Remove the given tag from the entry (if the tag is associated).
+ *
+ * @param Tag $tag
+ */
+ public function removeTag(Tag $tag)
+ {
+ if (!$this->tags->contains($tag)) {
+ return;
+ }
+
+ $this->tags->removeElement($tag);
+ $tag->removeEntry($this);
+ }
+
+ /**
+ * Remove all assigned tags from the entry.
+ */
+ public function removeAllTags()
+ {
+ foreach ($this->tags as $tag) {
+ $this->tags->removeElement($tag);
+ $tag->removeEntry($this);
+ }
+ }
+
+ /**
+ * Set previewPicture.
+ *
+ * @param string $previewPicture
+ *
+ * @return Entry
+ */
+ public function setPreviewPicture($previewPicture)
+ {
+ $this->previewPicture = $previewPicture;
+
+ return $this;
+ }
+
+ /**
+ * Get previewPicture.
+ *
+ * @return string
+ */
+ public function getPreviewPicture()
+ {
+ return $this->previewPicture;
+ }
+
+ /**
+ * Set language.
+ *
+ * @param string $language
+ *
+ * @return Entry
+ */
+ public function setLanguage($language)
+ {
+ $this->language = $language;
+
+ return $this;
+ }
+
+ /**
+ * Get language.
+ *
+ * @return string
+ */
+ public function getLanguage()
+ {
+ return $this->language;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUid()
+ {
+ return $this->uid;
+ }
+
+ /**
+ * @param string $uid
+ *
+ * @return Entry
+ */
+ public function setUid($uid)
+ {
+ $this->uid = $uid;
+
+ return $this;
+ }
+
+ public function generateUid()
+ {
+ if (null === $this->uid) {
+ // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter
+ $this->uid = uniqid('', true);
+ }
+ }
+
+ public function cleanUid()
+ {
+ $this->uid = null;
+ }
+
+ /**
+ * Used in the entries filter so it's more explicit for the end user than the uid.
+ * Also used in the API.
+ *
+ * @VirtualProperty
+ * @SerializedName("is_public")
+ * @Groups({"entries_for_user"})
+ *
+ * @return bool