From 0bd2cb1ecd2f9194735af77142390a94723d1b39 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sun, 22 Feb 2015 10:50:27 +0100 Subject: Handle default value for new user --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 9 ++++----- src/Wallabag/CoreBundle/Controller/ConfigController.php | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/Wallabag') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index a4301958..c1b72604 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -135,11 +135,10 @@ class InstallCommand extends ContainerAwareCommand $em->persist($user); - $config = new Config(); - $config->setUser($user); - $config->setTheme('baggy'); - $config->setItemsPerPage(10); - $config->setLanguage('en_US'); + $config = new Config($user); + $config->setTheme($this->getContainer()->getParameter('theme')); + $config->setItemsPerPage($this->getContainer()->getParameter('items_on_page')); + $config->setLanguage($this->getContainer()->getParameter('language')); $em->persist($config); } diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index aedbc999..68e034fa 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -81,6 +81,14 @@ class ConfigController extends Controller if ($newUserForm->isValid()) { $em->persist($newUser); + + $config = new Config($newUser); + $config->setTheme($this->container->getParameter('theme')); + $config->setItemsPerPage($this->container->getParameter('items_on_page')); + $config->setLanguage($this->container->getParameter('language')); + + $em->persist($config); + $em->flush(); $this->get('session')->getFlashBag()->add( -- cgit v1.2.3