X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FEntry.php;h=cba72d31e07385ba736638df84c14862a31cf5a1;hb=a05b61159e147776f63baee731b5026796e5f7ae;hp=a0503c3918170dfbb9fc8bb29a0e8a4f22f72f4c;hpb=42708d1121fef12c84487247b170eb03083d5ffc;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index a0503c39..cba72d31 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -5,14 +5,14 @@ namespace Wallabag\CoreBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Hateoas\Configuration\Annotation as Hateoas; -use JMS\Serializer\Annotation\Groups; -use JMS\Serializer\Annotation\XmlRoot; use JMS\Serializer\Annotation\Exclude; -use JMS\Serializer\Annotation\VirtualProperty; +use JMS\Serializer\Annotation\Groups; use JMS\Serializer\Annotation\SerializedName; +use JMS\Serializer\Annotation\VirtualProperty; +use JMS\Serializer\Annotation\XmlRoot; use Symfony\Component\Validator\Constraints as Assert; -use Wallabag\UserBundle\Entity\User; use Wallabag\AnnotationBundle\Entity\Annotation; +use Wallabag\UserBundle\Entity\User; /** * Entry. @@ -478,7 +478,7 @@ class Entry */ public function timestamps() { - if (is_null($this->createdAt)) { + if (null === $this->createdAt) { $this->createdAt = new \DateTime(); } @@ -593,6 +593,11 @@ class Entry $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)) { @@ -603,6 +608,17 @@ class Entry $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. *