Handle default value for new user

This commit is contained in:
Jeremy 2015-02-22 10:50:27 +01:00
parent e4977b8a86
commit 0bd2cb1ecd
3 changed files with 15 additions and 6 deletions

View File

@ -37,5 +37,7 @@ parameters:
export_mobi: true
export_pdf: true
# List view
# default user config
items_on_page: 12
theme: baggy
language: en_US

View File

@ -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);
}

View File

@ -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(