Wallabag\CoreBundle\Entity\Entry::removeTag PHP Méthode

removeTag() public méthode

public removeTag ( Wallabag\CoreBundle\Entity\Tag $tag )
$tag Wallabag\CoreBundle\Entity\Tag
    public function removeTag(Tag $tag)
    {
        if (!$this->tags->contains($tag)) {
            return;
        }
        $this->tags->removeElement($tag);
        $tag->removeEntry($this);
    }

Usage Example

Exemple #1
0
 /**
  * Removes tag from entry.
  *
  * @Route("/remove-tag/{entry}/{tag}", requirements={"entry" = "\d+", "tag" = "\d+"}, name="remove_tag")
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag)
 {
     $entry->removeTag($tag);
     $em = $this->getDoctrine()->getManager();
     $em->flush();
     if (count($tag->getEntries()) == 0) {
         $em->remove($tag);
     }
     $em->flush();
     $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'));
     return $this->redirect($redirectUrl);
 }
All Usage Examples Of Wallabag\CoreBundle\Entity\Entry::removeTag