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