X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FTag.php;h=4ed588be867be0a3b38227dce42b863999721bee;hb=82899c040258896bff540080602e93aa49a71ae8;hp=6067360f9bbfa0b53ecf350a45dce52bcf09f06a;hpb=1210dae10589515d6f3824c75639342c5e1d52dd;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 6067360f..4ed588be 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") */ @@ -36,6 +37,12 @@ class Tag */ private $label; + /** + * @Gedmo\Slug(fields={"label"}) + * @ORM\Column(length=128, unique=true) + */ + private $slug; + /** * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"}) */ @@ -46,7 +53,7 @@ class Tag */ private $user; - public function __construct(User $user) + public function __construct(\Wallabag\UserBundle\Entity\User $user) { $this->user = $user; $this->entries = new ArrayCollection(); @@ -91,6 +98,11 @@ class Tag return $this->label; } + public function getSlug() + { + return $this->slug; + } + public function addEntry(Entry $entry) { $this->entries[] = $entry;