aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
diff options
context:
space:
mode:
authorJeremy <jeremy.benoist@gmail.com>2015-02-22 14:35:36 +0100
committerJeremy <jeremy.benoist@gmail.com>2015-02-22 14:35:36 +0100
commit0bf99bb144561525a34a50315b95efd6f543fe35 (patch)
treef438281ef6300e2373f049b1d4137a5475794641 /src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
parent0bd2cb1ecd2f9194735af77142390a94723d1b39 (diff)
downloadwallabag-0bf99bb144561525a34a50315b95efd6f543fe35.tar.gz
wallabag-0bf99bb144561525a34a50315b95efd6f543fe35.tar.zst
wallabag-0bf99bb144561525a34a50315b95efd6f543fe35.zip
Improve install command & add test
Also add fixtures for Config InstallCommand now check if database, schema are here and ask the user what to do (keep or trash & re-create)
Diffstat (limited to 'src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php')
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
new file mode 100644
index 00000000..900e151d
--- /dev/null
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
@@ -0,0 +1,45 @@
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures\ORM;
4
5use Doctrine\Common\DataFixtures\AbstractFixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\Config;
9
10class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
11{
12 /**
13 * {@inheritDoc}
14 */
15 public function load(ObjectManager $manager)
16 {
17 $adminConfig = new Config($this->getReference('admin-user'));
18 $adminConfig->setTheme('baggy');
19 $adminConfig->setItemsPerPage(30);
20 $adminConfig->setLanguage('en_US');
21
22 $manager->persist($adminConfig);
23
24 $this->addReference('admin-config', $adminConfig);
25
26 $bobConfig = new Config($this->getReference('bob-user'));
27 $bobConfig->setTheme('default');
28 $bobConfig->setItemsPerPage(10);
29 $bobConfig->setLanguage('fr_FR');
30
31 $manager->persist($bobConfig);
32
33 $this->addReference('bob-config', $bobConfig);
34
35 $manager->flush();
36 }
37
38 /**
39 * {@inheritDoc}
40 */
41 public function getOrder()
42 {
43 return 20;
44 }
45}