diff options
author | Jeremy <jeremy.benoist@gmail.com> | 2015-02-22 14:35:36 +0100 |
---|---|---|
committer | Jeremy <jeremy.benoist@gmail.com> | 2015-02-22 14:35:36 +0100 |
commit | 0bf99bb144561525a34a50315b95efd6f543fe35 (patch) | |
tree | f438281ef6300e2373f049b1d4137a5475794641 /src/Wallabag/CoreBundle/DataFixtures | |
parent | 0bd2cb1ecd2f9194735af77142390a94723d1b39 (diff) | |
download | wallabag-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')
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php | 45 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | 2 |
2 files changed, 46 insertions, 1 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 | |||
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\Config; | ||
9 | |||
10 | class 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 | } | ||
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php index 520b44b8..3be323ed 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | |||
@@ -49,6 +49,6 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
49 | */ | 49 | */ |
50 | public function getOrder() | 50 | public function getOrder() |
51 | { | 51 | { |
52 | return 20; | 52 | return 30; |
53 | } | 53 | } |
54 | } | 54 | } |