aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity/Tag.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-24 07:42:09 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-03-06 20:50:31 +0100
commit46bbd8d321e6a00131f0e6ed96fa6f3d693b3678 (patch)
tree331d511837716ec7a7956c35f51dc3a14a1ca11c /src/Wallabag/CoreBundle/Entity/Tag.php
parent6c87418ff013cfd03093c3f01e20518e580d80bb (diff)
downloadwallabag-46bbd8d321e6a00131f0e6ed96fa6f3d693b3678.tar.gz
wallabag-46bbd8d321e6a00131f0e6ed96fa6f3d693b3678.tar.zst
wallabag-46bbd8d321e6a00131f0e6ed96fa6f3d693b3678.zip
relation between tags and entries
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Tag.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php
index 1cdf4df0..5aed1fa0 100644
--- a/src/Wallabag/CoreBundle/Entity/Tag.php
+++ b/src/Wallabag/CoreBundle/Entity/Tag.php
@@ -6,6 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
6use JMS\Serializer\Annotation\XmlRoot; 6use JMS\Serializer\Annotation\XmlRoot;
7use JMS\Serializer\Annotation\ExclusionPolicy; 7use JMS\Serializer\Annotation\ExclusionPolicy;
8use JMS\Serializer\Annotation\Expose; 8use JMS\Serializer\Annotation\Expose;
9use Doctrine\Common\Collections\ArrayCollection;
9 10
10/** 11/**
11 * Tag 12 * Tag
@@ -36,10 +37,14 @@ class Tag
36 private $label; 37 private $label;
37 38
38 /** 39 /**
39 * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist", "merge"}) 40 * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
40 */ 41 */
41 private $entries; 42 private $entries;
42 43
44 public function __construct()
45 {
46 $this->entries = new ArrayCollection();
47 }
43 /** 48 /**
44 * Get id 49 * Get id
45 * 50 *
@@ -72,4 +77,9 @@ class Tag
72 { 77 {
73 return $this->label; 78 return $this->label;
74 } 79 }
80
81 public function addEntry(Entry $entry)
82 {
83 $this->entries[] = $entry;
84 }
75} 85}