From 2691cf04384239c546e141af6cc3c22b210dae58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 20 Feb 2015 16:38:24 +0100 Subject: GET /api/tags/id_tag method --- src/Wallabag/CoreBundle/Entity/Tag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php') diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 31017563..963f32b1 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -58,6 +58,6 @@ class Tag */ public function getLabel() { - return $this->value; + return $this->label; } } -- cgit v1.2.3 From 6d37a7e6c11666c2c220c9eb358a877f15bcfa0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 20 Feb 2015 17:20:12 +0100 Subject: remove dumb code --- src/Wallabag/CoreBundle/Entity/Tag.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php') diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 963f32b1..0d7f8c2b 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -3,12 +3,14 @@ namespace Wallabag\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use JMS\Serializer\Annotation\XmlRoot; /** * Tag * + * @XmlRoot("tag") * @ORM\Table(name="tag") - * @ORM\Entity + * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository") */ class Tag { -- cgit v1.2.3 From 0a018fe03980b35c9f7aca838e67a8efa43b7f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 20 Feb 2015 20:29:33 +0100 Subject: add relation between entry and tag --- src/Wallabag/CoreBundle/Entity/Tag.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php') diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 0d7f8c2b..1cdf4df0 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -4,6 +4,8 @@ namespace Wallabag\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation\XmlRoot; +use JMS\Serializer\Annotation\ExclusionPolicy; +use JMS\Serializer\Annotation\Expose; /** * Tag @@ -11,12 +13,14 @@ use JMS\Serializer\Annotation\XmlRoot; * @XmlRoot("tag") * @ORM\Table(name="tag") * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TagRepository") + * @ExclusionPolicy("all") */ class Tag { /** * @var integer * + * @Expose * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") @@ -26,10 +30,16 @@ class Tag /** * @var string * + * @Expose * @ORM\Column(name="label", type="text") */ private $label; + /** + * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist", "merge"}) + */ + private $entries; + /** * Get id * -- cgit v1.2.3 From 46bbd8d321e6a00131f0e6ed96fa6f3d693b3678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 24 Feb 2015 07:42:09 +0100 Subject: relation between tags and entries --- src/Wallabag/CoreBundle/Entity/Tag.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php') 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; use JMS\Serializer\Annotation\XmlRoot; use JMS\Serializer\Annotation\ExclusionPolicy; use JMS\Serializer\Annotation\Expose; +use Doctrine\Common\Collections\ArrayCollection; /** * Tag @@ -36,10 +37,14 @@ class Tag private $label; /** - * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist", "merge"}) + * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"}) */ private $entries; + public function __construct() + { + $this->entries = new ArrayCollection(); + } /** * Get id * @@ -72,4 +77,9 @@ class Tag { return $this->label; } + + public function addEntry(Entry $entry) + { + $this->entries[] = $entry; + } } -- cgit v1.2.3 From 092ca70725b0263390e45c46f93828c613eca3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 26 Feb 2015 09:41:42 +0100 Subject: add relation between user and tags, tests are broken --- src/Wallabag/CoreBundle/Entity/Tag.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php') diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 5aed1fa0..29a5e4b5 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -41,8 +41,14 @@ 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(); } /** -- cgit v1.2.3 From 48b67328e24f1cde00287613507a8f5fcd222f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 5 Mar 2015 19:41:23 +0100 Subject: add getUser on Tag entity --- src/Wallabag/CoreBundle/Entity/Tag.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Wallabag/CoreBundle/Entity/Tag.php') diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php index 29a5e4b5..9ae5867c 100644 --- a/src/Wallabag/CoreBundle/Entity/Tag.php +++ b/src/Wallabag/CoreBundle/Entity/Tag.php @@ -88,4 +88,12 @@ class Tag { $this->entries[] = $entry; } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } } -- cgit v1.2.3