diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-12-29 14:50:52 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-12-29 14:50:52 +0100 |
commit | fc73222723c7a0c9b577805d3ef51eb96b124b92 (patch) | |
tree | 002b77b82266b1e497e3683e72f4a457d4353633 /src/Wallabag/CoreBundle/DataFixtures | |
parent | c997cfcc9c161241a6398b0942a1a869688d807a (diff) | |
download | wallabag-fc73222723c7a0c9b577805d3ef51eb96b124b92.tar.gz wallabag-fc73222723c7a0c9b577805d3ef51eb96b124b92.tar.zst wallabag-fc73222723c7a0c9b577805d3ef51eb96b124b92.zip |
Remove user reference in tag
Fix #1543
Diffstat (limited to 'src/Wallabag/CoreBundle/DataFixtures')
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | 19 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php | 41 |
2 files changed, 45 insertions, 15 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php index 0513cdb8..6c6a331a 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | |||
@@ -6,7 +6,6 @@ use Doctrine\Common\DataFixtures\AbstractFixture; | |||
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | 6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; |
7 | use Doctrine\Common\Persistence\ObjectManager; | 7 | use Doctrine\Common\Persistence\ObjectManager; |
8 | use Wallabag\CoreBundle\Entity\Entry; | 8 | use Wallabag\CoreBundle\Entity\Entry; |
9 | use Wallabag\CoreBundle\Entity\Tag; | ||
10 | 9 | ||
11 | class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | 10 | class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface |
12 | { | 11 | { |
@@ -50,13 +49,8 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
50 | $entry3->setContent('This is my content /o/'); | 49 | $entry3->setContent('This is my content /o/'); |
51 | $entry3->setLanguage('en'); | 50 | $entry3->setLanguage('en'); |
52 | 51 | ||
53 | $tag1 = new Tag($this->getReference('bob-user')); | 52 | $entry3->addTag($this->getReference('foo-tag')); |
54 | $tag1->setLabel('foo'); | 53 | $entry3->addTag($this->getReference('bar-tag')); |
55 | $tag2 = new Tag($this->getReference('bob-user')); | ||
56 | $tag2->setLabel('bar'); | ||
57 | |||
58 | $entry3->addTag($tag1); | ||
59 | $entry3->addTag($tag2); | ||
60 | 54 | ||
61 | $manager->persist($entry3); | 55 | $manager->persist($entry3); |
62 | 56 | ||
@@ -71,13 +65,8 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
71 | $entry4->setContent('This is my content /o/'); | 65 | $entry4->setContent('This is my content /o/'); |
72 | $entry4->setLanguage('en'); | 66 | $entry4->setLanguage('en'); |
73 | 67 | ||
74 | $tag1 = new Tag($this->getReference('admin-user')); | 68 | $entry4->addTag($this->getReference('foo-tag')); |
75 | $tag1->setLabel('foo'); | 69 | $entry4->addTag($this->getReference('bar-tag')); |
76 | $tag2 = new Tag($this->getReference('admin-user')); | ||
77 | $tag2->setLabel('bar'); | ||
78 | |||
79 | $entry4->addTag($tag1); | ||
80 | $entry4->addTag($tag2); | ||
81 | 70 | ||
82 | $manager->persist($entry4); | 71 | $manager->persist($entry4); |
83 | 72 | ||
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php new file mode 100644 index 00000000..8553dced --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php | |||
@@ -0,0 +1,41 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\DataFixtures\ORM; | ||
4 | |||
5 | use Doctrine\Common\DataFixtures\AbstractFixture; | ||
6 | use Doctrine\Common\DataFixtures\OrderedFixtureInterface; | ||
7 | use Doctrine\Common\Persistence\ObjectManager; | ||
8 | use Wallabag\CoreBundle\Entity\Tag; | ||
9 | |||
10 | class LoadTagData extends AbstractFixture implements OrderedFixtureInterface | ||
11 | { | ||
12 | /** | ||
13 | * {@inheritdoc} | ||
14 | */ | ||
15 | public function load(ObjectManager $manager) | ||
16 | { | ||
17 | $tag1 = new Tag(); | ||
18 | $tag1->setLabel('foo'); | ||
19 | |||
20 | $manager->persist($tag1); | ||
21 | |||
22 | $this->addReference('foo-tag', $tag1); | ||
23 | |||
24 | $tag2 = new Tag(); | ||
25 | $tag2->setLabel('bar'); | ||
26 | |||
27 | $manager->persist($tag2); | ||
28 | |||
29 | $this->addReference('bar-tag', $tag2); | ||
30 | |||
31 | $manager->flush(); | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * {@inheritdoc} | ||
36 | */ | ||
37 | public function getOrder() | ||
38 | { | ||
39 | return 25; | ||
40 | } | ||
41 | } | ||