Exemple #1
0
 /**
  * @param Tag $tag
  * @return bool
  */
 public function removeTag(Tag $tag)
 {
     if ($this->hasTag($tag)) {
         return $this->tags->removeElement($tag);
     }
     return false;
 }
Exemple #2
0
 /**
  * Remove tags
  * @param Collection|Tag[] $tags
  * @return self
  */
 public function removeTags(Collection $tags)
 {
     foreach ($tags as $tag) {
         $this->tags->removeElement($tag);
     }
     return $this;
 }
Exemple #3
0
 /**
  * @param Article $article
  * @return bool
  */
 public function removeArticle(Article $article)
 {
     if ($this->hasArticle($article)) {
         return $this->articles->removeElement($article);
     }
     return false;
 }
Exemple #4
0
 /**
  * @param Tag $tag
  */
 public function addTag(Tag $tag)
 {
     $this->tags->add($tag);
 }
Exemple #5
0
 /**
  * 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()];
 }
Exemple #6
0
 /**
  * @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);
 }