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 --- .../CoreBundle/DataFixtures/ORM/LoadTagData.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php (limited to 'src/Wallabag/CoreBundle/DataFixtures') diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php new file mode 100644 index 00000000..6b13c2be --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php @@ -0,0 +1,42 @@ +setLabel('foo'); + + $manager->persist($tag1); + + $tag2 = new Tag(); + $tag2->setLabel('bar'); + + $manager->persist($tag2); + + $tag3 = new Tag(); + $tag3->setLabel('baz'); + + $manager->persist($tag3); + + $manager->flush(); + } + + /** + * {@inheritDoc} + */ + public function getOrder() + { + return 30; + } +} -- cgit v1.2.3 From 6c87418ff013cfd03093c3f01e20518e580d80bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 22 Feb 2015 21:25:24 +0100 Subject: fixtures for tag --- .../CoreBundle/DataFixtures/ORM/LoadTagData.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/Wallabag/CoreBundle/DataFixtures') diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php index 6b13c2be..4d9846b6 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php @@ -6,6 +6,7 @@ use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\Persistence\ObjectManager; use Wallabag\CoreBundle\Entity\Tag; +use Wallabag\CoreBundle\Entity\TagsEntries; class LoadTagData extends AbstractFixture implements OrderedFixtureInterface { @@ -19,16 +20,34 @@ class LoadTagData extends AbstractFixture implements OrderedFixtureInterface $manager->persist($tag1); + $this->addReference('tag1', $tag1); + + $tagsEntries1 = new TagsEntries(); + $tagsEntries1->setEntryId($this->getReference('entry1')); + $manager->persist($tagsEntries1); + $tag2 = new Tag(); $tag2->setLabel('bar'); $manager->persist($tag2); + $this->addReference('tag2', $tag2); + + $tagsEntries2 = new TagsEntries(); + $tagsEntries2->setEntryId($this->getReference('entry2')); + $manager->persist($tagsEntries2); + $tag3 = new Tag(); $tag3->setLabel('baz'); $manager->persist($tag3); + $this->addReference('tag3', $tag3); + + $tagsEntries3 = new TagsEntries(); + $tagsEntries3->setEntryId($this->getReference('entry2')); + $manager->persist($tagsEntries3); + $manager->flush(); } -- 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 --- .../CoreBundle/DataFixtures/ORM/LoadEntryData.php | 9 ++++ .../CoreBundle/DataFixtures/ORM/LoadTagData.php | 61 ---------------------- 2 files changed, 9 insertions(+), 61 deletions(-) delete mode 100644 src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php (limited to 'src/Wallabag/CoreBundle/DataFixtures') diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php index 3be323ed..edab9adc 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php @@ -6,6 +6,7 @@ use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\Persistence\ObjectManager; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\CoreBundle\Entity\Tag; class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface { @@ -37,6 +38,14 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry3->setTitle('test title entry3'); $entry3->setContent('This is my content /o/'); + $tag1 = new Tag(); + $tag1->setLabel("foo"); + $tag2 = new Tag(); + $tag2->setLabel("bar"); + + $entry3->addTag($tag1); + $entry3->addTag($tag2); + $manager->persist($entry3); $this->addReference('entry3', $entry3); diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php deleted file mode 100644 index 4d9846b6..00000000 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php +++ /dev/null @@ -1,61 +0,0 @@ -setLabel('foo'); - - $manager->persist($tag1); - - $this->addReference('tag1', $tag1); - - $tagsEntries1 = new TagsEntries(); - $tagsEntries1->setEntryId($this->getReference('entry1')); - $manager->persist($tagsEntries1); - - $tag2 = new Tag(); - $tag2->setLabel('bar'); - - $manager->persist($tag2); - - $this->addReference('tag2', $tag2); - - $tagsEntries2 = new TagsEntries(); - $tagsEntries2->setEntryId($this->getReference('entry2')); - $manager->persist($tagsEntries2); - - $tag3 = new Tag(); - $tag3->setLabel('baz'); - - $manager->persist($tag3); - - $this->addReference('tag3', $tag3); - - $tagsEntries3 = new TagsEntries(); - $tagsEntries3->setEntryId($this->getReference('entry2')); - $manager->persist($tagsEntries3); - - $manager->flush(); - } - - /** - * {@inheritDoc} - */ - public function getOrder() - { - return 30; - } -} -- 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/DataFixtures/ORM/LoadEntryData.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/DataFixtures') diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php index edab9adc..b0f07755 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php @@ -38,9 +38,9 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry3->setTitle('test title entry3'); $entry3->setContent('This is my content /o/'); - $tag1 = new Tag(); + $tag1 = new Tag($this->getReference('admin-user')); $tag1->setLabel("foo"); - $tag2 = new Tag(); + $tag2 = new Tag($this->getReference('admin-user')); $tag2->setLabel("bar"); $entry3->addTag($tag1); -- cgit v1.2.3 From b0cce9e6369b0b821c01163a0e4df5552f9924f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 27 Feb 2015 15:24:36 +0100 Subject: fix tests for GET /entries/tags --- .../CoreBundle/DataFixtures/ORM/LoadEntryData.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/DataFixtures') diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php index b0f07755..ce12ec5d 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php @@ -38,9 +38,9 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry3->setTitle('test title entry3'); $entry3->setContent('This is my content /o/'); - $tag1 = new Tag($this->getReference('admin-user')); + $tag1 = new Tag($this->getReference('bob-user')); $tag1->setLabel("foo"); - $tag2 = new Tag($this->getReference('admin-user')); + $tag2 = new Tag($this->getReference('bob-user')); $tag2->setLabel("bar"); $entry3->addTag($tag1); @@ -50,6 +50,23 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $this->addReference('entry3', $entry3); + $entry4 = new Entry($this->getReference('admin-user')); + $entry4->setUrl('http://0.0.0.0'); + $entry4->setTitle('test title entry4'); + $entry4->setContent('This is my content /o/'); + + $tag1 = new Tag($this->getReference('admin-user')); + $tag1->setLabel("foo"); + $tag2 = new Tag($this->getReference('admin-user')); + $tag2->setLabel("bar"); + + $entry4->addTag($tag1); + $entry4->addTag($tag2); + + $manager->persist($entry4); + + $this->addReference('entry4', $entry4); + $manager->flush(); } -- cgit v1.2.3