/** * @param Tag $tag * @return bool */ public function removeTag(Tag $tag) { if ($this->hasTag($tag)) { return $this->tags->removeElement($tag); } return false; }
/** * Remove tags * @param Collection|Tag[] $tags * @return self */ public function removeTags(Collection $tags) { foreach ($tags as $tag) { $this->tags->removeElement($tag); } return $this; }
/** * @param Article $article * @return bool */ public function removeArticle(Article $article) { if ($this->hasArticle($article)) { return $this->articles->removeElement($article); } return false; }
/** * @param Tag $tag */ public function addTag(Tag $tag) { $this->tags->add($tag); }
/** * Specify data which should be serialized to JSON * @link http://php.net/manual/en/jsonserializable.jsonserialize.php * @return mixed data which can be serialized by <b>json_encode</b>, * which is a value of any type other than a resource. * @since 5.4.0 */ public function jsonSerialize() { return ['shortCode' => $this->shortCode, 'originalUrl' => $this->originalUrl, 'dateCreated' => isset($this->dateCreated) ? $this->dateCreated->format(\DateTime::ISO8601) : null, 'visitsCount' => count($this->visits), 'tags' => $this->tags->toArray()]; }
/** * @param Tag $tag */ public function removeTag(Tag $tag) { $tag->setNews(null); $this->tags->removeElement($tag); }
/** * @param Tag $tag */ public function removeTag(Tag $tag) { $this->tags->removeElement($tag); }