diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Tag.php | 12 |
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; | |||
6 | use JMS\Serializer\Annotation\XmlRoot; | 6 | use JMS\Serializer\Annotation\XmlRoot; |
7 | use JMS\Serializer\Annotation\ExclusionPolicy; | 7 | use JMS\Serializer\Annotation\ExclusionPolicy; |
8 | use JMS\Serializer\Annotation\Expose; | 8 | use JMS\Serializer\Annotation\Expose; |
9 | use 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 | } |