X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FEntry.php;h=24b24dbb13dc6ac29cc6a5fd736367cf26d72387;hb=1930c19d8214c05ceefac5ac011a6b6e7e4a983d;hp=608ed2f0d4ababf41230640cfb45804b137cf687;hpb=a7f1921f7db312b5def3839393357f443dcbb52c;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 608ed2f0..24b24dbb 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -4,10 +4,10 @@ namespace Wallabag\CoreBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Validator\Constraints as Assert; use Hateoas\Configuration\Annotation as Hateoas; use JMS\Serializer\Annotation\Groups; use JMS\Serializer\Annotation\XmlRoot; +use Symfony\Component\Validator\Constraints as Assert; use Wallabag\UserBundle\Entity\User; /** @@ -245,7 +245,7 @@ class Entry /** * Set isArchived. * - * @param string $isArchived + * @param bool $isArchived * * @return Entry */ @@ -259,7 +259,7 @@ class Entry /** * Get isArchived. * - * @return string + * @return bool */ public function isArchived() { @@ -276,7 +276,7 @@ class Entry /** * Set isStarred. * - * @param string $isStarred + * @param bool $isStarred * * @return Entry */ @@ -290,7 +290,7 @@ class Entry /** * Get isStarred. * - * @return string + * @return bool */ public function isStarred() { @@ -462,6 +462,14 @@ class Entry return; } + // check if tag already exist but has not yet be persisted + // it seems that the previous condition with `contains()` doesn't check that case + foreach ($this->tags as $existingTag) { + if ($existingTag->getLabel() === $tag->getLabel()) { + return; + } + } + $this->tags[] = $tag; $tag->addEntry($this); }