]>
Commit | Line | Data |
---|---|---|
d6ba77e8 JB |
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 Craue\ConfigBundle\Entity\Setting; | |
9 | ||
10 | class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface | |
11 | { | |
12 | /** | |
13 | * {@inheritdoc} | |
14 | */ | |
15 | public function load(ObjectManager $manager) | |
16 | { | |
17 | $settings = [ | |
d6ba77e8 JB |
18 | [ |
19 | 'name' => 'carrot', | |
20 | 'value' => '1', | |
21 | 'section' => 'entry', | |
22 | ], | |
23 | [ | |
24 | 'name' => 'share_diaspora', | |
25 | 'value' => '1', | |
26 | 'section' => 'entry', | |
27 | ], | |
28 | [ | |
29 | 'name' => 'diaspora_url', | |
30 | 'value' => 'http://diasporapod.com', | |
31 | 'section' => 'entry', | |
32 | ], | |
33 | [ | |
34 | 'name' => 'share_shaarli', | |
35 | 'value' => '1', | |
36 | 'section' => 'entry', | |
37 | ], | |
38 | [ | |
39 | 'name' => 'shaarli_url', | |
40 | 'value' => 'http://myshaarli.com', | |
41 | 'section' => 'entry', | |
42 | ], | |
43 | [ | |
44 | 'name' => 'share_mail', | |
45 | 'value' => '1', | |
46 | 'section' => 'entry', | |
47 | ], | |
48 | [ | |
49 | 'name' => 'share_twitter', | |
50 | 'value' => '1', | |
51 | 'section' => 'entry', | |
52 | ], | |
53 | [ | |
54 | 'name' => 'export_epub', | |
55 | 'value' => '1', | |
56 | 'section' => 'export', | |
57 | ], | |
58 | [ | |
59 | 'name' => 'export_mobi', | |
60 | 'value' => '1', | |
61 | 'section' => 'export', | |
62 | ], | |
63 | [ | |
64 | 'name' => 'export_pdf', | |
65 | 'value' => '1', | |
66 | 'section' => 'export', | |
67 | ], | |
a74a6ca2 JB |
68 | [ |
69 | 'name' => 'export_csv', | |
70 | 'value' => '1', | |
71 | 'section' => 'export', | |
72 | ], | |
73 | [ | |
74 | 'name' => 'export_json', | |
75 | 'value' => '1', | |
76 | 'section' => 'export', | |
77 | ], | |
78 | [ | |
79 | 'name' => 'export_txt', | |
80 | 'value' => '1', | |
81 | 'section' => 'export', | |
82 | ], | |
83 | [ | |
84 | 'name' => 'export_xml', | |
85 | 'value' => '1', | |
86 | 'section' => 'export', | |
87 | ], | |
d6ba77e8 JB |
88 | [ |
89 | 'name' => 'pocket_consumer_key', | |
1c7d6664 | 90 | 'value' => null, |
d6ba77e8 JB |
91 | 'section' => 'import', |
92 | ], | |
93 | [ | |
94 | 'name' => 'show_printlink', | |
95 | 'value' => '1', | |
96 | 'section' => 'entry', | |
97 | ], | |
98 | [ | |
99 | 'name' => 'wallabag_support_url', | |
100 | 'value' => 'https://www.wallabag.org/pages/support.html', | |
101 | 'section' => 'misc', | |
102 | ], | |
103 | [ | |
104 | 'name' => 'wallabag_url', | |
105 | 'value' => 'http://v2.wallabag.org', | |
106 | 'section' => 'misc', | |
107 | ], | |
07643dde NL |
108 | [ |
109 | 'name' => 'piwik_enabled', | |
110 | 'value' => '0', | |
111 | 'section' => 'analytics', | |
112 | ], | |
113 | [ | |
114 | 'name' => 'piwik_host', | |
115 | 'value' => 'http://v2.wallabag.org', | |
116 | 'section' => 'analytics', | |
117 | ], | |
118 | [ | |
119 | 'name' => 'piwik_site_id', | |
120 | 'value' => '1', | |
121 | 'section' => 'analytics', | |
122 | ], | |
a4f42c59 JB |
123 | [ |
124 | 'name' => 'demo_mode_enabled', | |
125 | 'value' => '0', | |
126 | 'section' => 'misc', | |
127 | ], | |
128 | [ | |
129 | 'name' => 'demo_mode_username', | |
130 | 'value' => 'wallabag', | |
131 | 'section' => 'misc', | |
132 | ], | |
d6ba77e8 JB |
133 | ]; |
134 | ||
135 | foreach ($settings as $setting) { | |
136 | $newSetting = new Setting(); | |
137 | $newSetting->setName($setting['name']); | |
138 | $newSetting->setValue($setting['value']); | |
139 | $newSetting->setSection($setting['section']); | |
140 | $manager->persist($newSetting); | |
141 | } | |
142 | ||
143 | $manager->flush(); | |
144 | } | |
145 | ||
146 | /** | |
147 | * {@inheritdoc} | |
148 | */ | |
149 | public function getOrder() | |
150 | { | |
151 | return 50; | |
152 | } | |
153 | } |