+
+ public function getSlug()
+ {
+ return $this->slug;
+ }
+
+ /**
+ * @param Entry $entry
+ */
+ public function addEntry(Entry $entry)
+ {
+ if ($this->entries->contains($entry)) {
+ return;
+ }
+
+ $this->entries->add($entry);
+ $entry->addTag($this);
+ }
+
+ /**
+ * @param Entry $entry
+ */
+ public function removeEntry(Entry $entry)
+ {
+ if (!$this->entries->contains($entry)) {
+ return;
+ }
+
+ $this->entries->removeElement($entry);
+ $entry->removeTag($this);
+ }
+
+ public function hasEntry($entry)
+ {
+ return $this->entries->contains($entry);
+ }
+
+ /**
+ * Get entries for this tag.
+ *
+ * @return ArrayCollection<Entry>
+ */
+ public function getEntries()
+ {
+ return $this->entries;
+ }
+
+ public function getEntriesByUserId($userId)
+ {
+ $filteredEntries = new ArrayCollection();
+ foreach ($this->entries as $entry) {
+ if ($entry->getUser()->getId() === $userId) {
+ $filteredEntries->add($entry);
+ }
+ }
+
+ return $filteredEntries;
+ }