X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FTag.php;h=92442df6ddb00ad823f43bc53f0c534d6be0760a;hb=d0b90fbe18da72dc09a0ef748fa178314f6657b6;hp=5aed1fa010008727e3550a6763f710d291ec212f;hpb=46bbd8d321e6a00131f0e6ed96fa6f3d693b3678;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 5aed1fa0..92442df6 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -9,17 +9,17 @@ use JMS\Serializer\Annotation\Expose; use Doctrine\Common\Collections\ArrayCollection; /** - * Tag + * Tag. * * @XmlRoot("tag") - * @ORM\Table(name="tag") + * @ORM\Table * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository") * @ExclusionPolicy("all") */ class Tag { /** - * @var integer + * @var int * * @Expose * @ORM\Column(name="id", type="integer") @@ -41,14 +41,26 @@ class Tag */ private $entries; - public function __construct() + /** + * @ORM\ManyToOne(targetEntity="User", inversedBy="tags") + */ + private $user; + + public function __construct(User $user) { + $this->user = $user; $this->entries = new ArrayCollection(); } + + public function __toString() + { + return $this->label; + } + /** - * Get id + * Get id. * - * @return integer + * @return int */ public function getId() { @@ -56,9 +68,10 @@ class Tag } /** - * Set label + * Set label. + * + * @param string $label * - * @param string $label * @return Tag */ public function setLabel($label) @@ -69,7 +82,7 @@ class Tag } /** - * Get label + * Get label. * * @return string */ @@ -82,4 +95,12 @@ class Tag { $this->entries[] = $entry; } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } }