diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/Entry.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index e47848b6..e0d1b839 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Entity; | 3 | namespace Wallabag\CoreBundle\Entity; |
4 | 4 | ||
5 | use Doctrine\Common\Collections\ArrayCollection; | ||
5 | use Doctrine\ORM\Mapping as ORM; | 6 | use Doctrine\ORM\Mapping as ORM; |
6 | use Symfony\Component\Validator\Constraints as Assert; | 7 | use Symfony\Component\Validator\Constraints as Assert; |
7 | use Hateoas\Configuration\Annotation as Hateoas; | 8 | use Hateoas\Configuration\Annotation as Hateoas; |
@@ -118,12 +119,22 @@ class Entry | |||
118 | */ | 119 | */ |
119 | private $user; | 120 | private $user; |
120 | 121 | ||
122 | /** | ||
123 | * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist", "merge"}) | ||
124 | * @ORM\JoinTable(name="tags_entries", | ||
125 | * joinColumns={@ORM\JoinColumn(name="entry_id", referencedColumnName="id")}, | ||
126 | * inverseJoinColumns={@ORM\JoinColumn(name="tag_id", referencedColumnName="id")} | ||
127 | * ) | ||
128 | */ | ||
129 | private $tags; | ||
130 | |||
121 | /* | 131 | /* |
122 | * @param User $user | 132 | * @param User $user |
123 | */ | 133 | */ |
124 | public function __construct(User $user) | 134 | public function __construct(User $user) |
125 | { | 135 | { |
126 | $this->user = $user; | 136 | $this->user = $user; |
137 | $this->tags = new ArrayCollection(); | ||
127 | } | 138 | } |
128 | 139 | ||
129 | /** | 140 | /** |
@@ -381,4 +392,20 @@ class Entry | |||
381 | { | 392 | { |
382 | $this->isPublic = $isPublic; | 393 | $this->isPublic = $isPublic; |
383 | } | 394 | } |
395 | |||
396 | /** | ||
397 | * @return ArrayCollection<Tag> | ||
398 | */ | ||
399 | public function getTags() | ||
400 | { | ||
401 | return $this->tags; | ||
402 | } | ||
403 | |||
404 | /** | ||
405 | * @param Tag $tag | ||
406 | */ | ||
407 | public function addTag(Tag $tag) | ||
408 | { | ||
409 | $this->tags[] = $tag; | ||
410 | } | ||
384 | } | 411 | } |