aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-22 21:25:24 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-03-06 20:50:30 +0100
commit6c87418ff013cfd03093c3f01e20518e580d80bb (patch)
tree1d8900eac2a643122151ce4a3123d3c69233f818 /src/Wallabag
parent1bd12b62296569764ac329d88e964059dec530be (diff)
downloadwallabag-6c87418ff013cfd03093c3f01e20518e580d80bb.tar.gz
wallabag-6c87418ff013cfd03093c3f01e20518e580d80bb.tar.zst
wallabag-6c87418ff013cfd03093c3f01e20518e580d80bb.zip
fixtures for tag
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php19
-rw-r--r--src/Wallabag/CoreBundle/Entity/TagsEntries.php81
2 files changed, 100 insertions, 0 deletions
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;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface; 6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\Tag; 8use Wallabag\CoreBundle\Entity\Tag;
9use Wallabag\CoreBundle\Entity\TagsEntries;
9 10
10class LoadTagData extends AbstractFixture implements OrderedFixtureInterface 11class LoadTagData extends AbstractFixture implements OrderedFixtureInterface
11{ 12{
@@ -19,16 +20,34 @@ class LoadTagData extends AbstractFixture implements OrderedFixtureInterface
19 20
20 $manager->persist($tag1); 21 $manager->persist($tag1);
21 22
23 $this->addReference('tag1', $tag1);
24
25 $tagsEntries1 = new TagsEntries();
26 $tagsEntries1->setEntryId($this->getReference('entry1'));
27 $manager->persist($tagsEntries1);
28
22 $tag2 = new Tag(); 29 $tag2 = new Tag();
23 $tag2->setLabel('bar'); 30 $tag2->setLabel('bar');
24 31
25 $manager->persist($tag2); 32 $manager->persist($tag2);
26 33
34 $this->addReference('tag2', $tag2);
35
36 $tagsEntries2 = new TagsEntries();
37 $tagsEntries2->setEntryId($this->getReference('entry2'));
38 $manager->persist($tagsEntries2);
39
27 $tag3 = new Tag(); 40 $tag3 = new Tag();
28 $tag3->setLabel('baz'); 41 $tag3->setLabel('baz');
29 42
30 $manager->persist($tag3); 43 $manager->persist($tag3);
31 44
45 $this->addReference('tag3', $tag3);
46
47 $tagsEntries3 = new TagsEntries();
48 $tagsEntries3->setEntryId($this->getReference('entry2'));
49 $manager->persist($tagsEntries3);
50
32 $manager->flush(); 51 $manager->flush();
33 } 52 }
34 53
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 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * TagsEntries
9 *
10 * @ORM\Table(name="tags_entries")
11 */
12class TagsEntries
13{
14 /**
15 * @var integer
16 *
17 * @ORM\Column(name="id", type="integer")
18 * @ORM\Id
19 * @ORM\GeneratedValue(strategy="AUTO")
20 */
21 private $id;
22
23 /**
24 *
25 * @ORM\ManyToOne(targetEntity="Entry", inversedBy="tags_entries")
26 * @ORM\JoinColumn(name="entry_id", referencedColumnName="id")
27 *
28 */
29 private $entryId;
30
31 /**
32 *
33 * @ORM\ManyToOne(targetEntity="Tag", inversedBy="tags_entries")
34 * @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
35 *
36 */
37 private $tagId;
38
39 /**
40 * Get id
41 *
42 * @return integer
43 */
44 public function getId()
45 {
46 return $this->id;
47 }
48
49 /**
50 * @return mixed
51 */
52 public function getEntryId()
53 {
54 return $this->entryId;
55 }
56
57 /**
58 * @param mixed $entryId
59 */
60 public function setEntryId($entryId)
61 {
62 $this->entryId = $entryId;
63 }
64
65 /**
66 * @return mixed
67 */
68 public function getTagId()
69 {
70 return $this->tagId;
71 }
72
73 /**
74 * @param mixed $tagId
75 */
76 public function setTagId($tagId)
77 {
78 $this->tagId = $tagId;
79 }
80
81}