X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FTag.php;h=0689c7b31854fc0dbd58c40ca105d8a1c9c7cc68;hb=fc73222723c7a0c9b577805d3ef51eb96b124b92;hp=97c4579f70e8c1a607817a28ca5985912a2c8b3d;hpb=7244d6cb61912b80341595c56cc22d9bb56e6251;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 97c4579f..0689c7b3 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -7,12 +7,13 @@ use JMS\Serializer\Annotation\XmlRoot; use JMS\Serializer\Annotation\ExclusionPolicy; use JMS\Serializer\Annotation\Expose; use Doctrine\Common\Collections\ArrayCollection; +use Gedmo\Mapping\Annotation as Gedmo; /** * Tag. * * @XmlRoot("tag") - * @ORM\Table + * @ORM\Table(name="`tag`") * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository") * @ExclusionPolicy("all") */ @@ -37,18 +38,19 @@ class Tag private $label; /** - * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"}) + * @Expose + * @Gedmo\Slug(fields={"label"}) + * @ORM\Column(length=128, unique=true) */ - private $entries; + private $slug; /** - * @ORM\ManyToOne(targetEntity="User", inversedBy="tags") + * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"}) */ - private $user; + private $entries; - public function __construct(User $user) + public function __construct() { - $this->user = $user; $this->entries = new ArrayCollection(); } @@ -91,6 +93,11 @@ class Tag return $this->label; } + public function getSlug() + { + return $this->slug; + } + public function addEntry(Entry $entry) { $this->entries[] = $entry; @@ -100,12 +107,4 @@ class Tag { return $this->entries->contains($entry); } - - /** - * @return User - */ - public function getUser() - { - return $this->user; - } }