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 +++++ src/Wallabag/CoreBundle/Entity/TagsEntries.php | 81 ++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Entity/TagsEntries.php 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(); } diff --git a/src/Wallabag/CoreBundle/Entity/TagsEntries.php b/src/Wallabag/CoreBundle/Entity/TagsEntries.php new file mode 100644 index 00000000..589f26f8 --- /dev/null +++ b/src/Wallabag/CoreBundle/Entity/TagsEntries.php @@ -0,0 +1,81 @@ +id; + } + + /** + * @return mixed + */ + public function getEntryId() + { + return $this->entryId; + } + + /** + * @param mixed $entryId + */ + public function setEntryId($entryId) + { + $this->entryId = $entryId; + } + + /** + * @return mixed + */ + public function getTagId() + { + return $this->tagId; + } + + /** + * @param mixed $tagId + */ + public function setTagId($tagId) + { + $this->tagId = $tagId; + } + +} -- cgit v1.2.3