]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/DataFixtures/EntryFixtures.php
Update messages.pl.yml
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / DataFixtures / EntryFixtures.php
1 <?php
2
3 namespace Wallabag\CoreBundle\DataFixtures;
4
5 use Doctrine\Bundle\FixturesBundle\Fixture;
6 use Doctrine\Common\DataFixtures\DependentFixtureInterface;
7 use Doctrine\Common\Persistence\ObjectManager;
8 use Wallabag\CoreBundle\Entity\Entry;
9 use Wallabag\UserBundle\DataFixtures\UserFixtures;
10
11 class EntryFixtures extends Fixture implements DependentFixtureInterface
12 {
13 /**
14 * {@inheritdoc}
15 */
16 public function load(ObjectManager $manager)
17 {
18 $entry1 = new Entry($this->getReference('admin-user'));
19 $entry1->setUrl('http://0.0.0.0/entry1');
20 $entry1->setReadingTime(11);
21 $entry1->setDomainName('domain.io');
22 $entry1->setMimetype('text/html');
23 $entry1->setTitle('test title entry1');
24 $entry1->setContent('This is my content /o/');
25 $entry1->setLanguage('en');
26
27 $entry1->addTag($this->getReference('foo-tag'));
28 $entry1->addTag($this->getReference('baz-tag'));
29
30 $manager->persist($entry1);
31
32 $this->addReference('entry1', $entry1);
33
34 $entry2 = new Entry($this->getReference('admin-user'));
35 $entry2->setUrl('http://0.0.0.0/entry2');
36 $entry2->setReadingTime(1);
37 $entry2->setDomainName('domain.io');
38 $entry2->setMimetype('text/html');
39 $entry2->setTitle('test title entry2');
40 $entry2->setContent('This is my content /o/');
41 $entry2->setOriginUrl('ftp://oneftp.tld');
42 $entry2->setLanguage('fr');
43
44 $manager->persist($entry2);
45
46 $this->addReference('entry2', $entry2);
47
48 $entry3 = new Entry($this->getReference('bob-user'));
49 $entry3->setUrl('http://0.0.0.0/entry3');
50 $entry3->setReadingTime(1);
51 $entry3->setDomainName('domain.io');
52 $entry3->setMimetype('text/html');
53 $entry3->setTitle('test title entry3');
54 $entry3->setContent('This is my content /o/');
55 $entry3->setLanguage('en');
56
57 $entry3->addTag($this->getReference('foo-tag'));
58 $entry3->addTag($this->getReference('bar-tag'));
59
60 $manager->persist($entry3);
61
62 $this->addReference('entry3', $entry3);
63
64 $entry4 = new Entry($this->getReference('admin-user'));
65 $entry4->setUrl('http://0.0.0.0/entry4');
66 $entry4->setReadingTime(12);
67 $entry4->setDomainName('domain.io');
68 $entry4->setMimetype('text/html');
69 $entry4->setTitle('test title entry4');
70 $entry4->setContent('This is my content /o/');
71 $entry4->setLanguage('en');
72
73 $entry4->addTag($this->getReference('foo-tag'));
74 $entry4->addTag($this->getReference('bar-tag'));
75
76 $manager->persist($entry4);
77
78 $this->addReference('entry4', $entry4);
79
80 $entry5 = new Entry($this->getReference('admin-user'));
81 $entry5->setUrl('http://0.0.0.0/entry5');
82 $entry5->setReadingTime(12);
83 $entry5->setDomainName('domain.io');
84 $entry5->setMimetype('text/html');
85 $entry5->setTitle('test title entry5');
86 $entry5->setContent('This is my content /o/');
87 $entry5->setStarred(true);
88 $entry5->setLanguage('fr');
89 $entry5->setPreviewPicture('http://0.0.0.0/image.jpg');
90
91 $manager->persist($entry5);
92
93 $this->addReference('entry5', $entry5);
94
95 $entry6 = new Entry($this->getReference('admin-user'));
96 $entry6->setUrl('http://0.0.0.0/entry6');
97 $entry6->setReadingTime(12);
98 $entry6->setDomainName('domain.io');
99 $entry6->setMimetype('text/html');
100 $entry6->setTitle('test title entry6');
101 $entry6->setContent('This is my content /o/');
102 $entry6->updateArchived(true);
103 $entry6->setLanguage('de');
104 $entry6->addTag($this->getReference('bar-tag'));
105
106 $manager->persist($entry6);
107
108 $this->addReference('entry6', $entry6);
109
110 $manager->flush();
111 }
112
113 /**
114 * {@inheritdoc}
115 */
116 public function getDependencies()
117 {
118 return [
119 UserFixtures::class,
120 TagFixtures::class,
121 ];
122 }
123 }