From 32da2a70ef278bd42f66eb82c3fbf1905a417b87 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 23 Feb 2015 22:55:06 +0100 Subject: Add LiipThemeBundle Re-defined the config / user relation to be OneToOne bidirectionnal. ConfigType is now a service so I can inject the list of available themes that are also used by LiipThemeBundle Force sqlite for test In case of people use a different driver in parameter.yml (yes I do :)) --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 68e034fa..4e895875 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -7,7 +7,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\User; -use Wallabag\CoreBundle\Form\Type\ConfigType; use Wallabag\CoreBundle\Form\Type\ChangePasswordType; use Wallabag\CoreBundle\Form\Type\UserType; use Wallabag\CoreBundle\Form\Type\NewUserType; @@ -25,14 +24,18 @@ class ConfigController extends Controller $config = $this->getConfig(); $user = $this->getUser(); - // handle basic config detail - $configForm = $this->createForm(new ConfigType(), $config); + // handle basic config detail (this form is defined as a service) + $configForm = $this->createForm('config', $config); $configForm->handleRequest($request); if ($configForm->isValid()) { $em->persist($config); $em->flush(); + // switch active theme + $activeTheme = $this->get('liip_theme.active_theme'); + $activeTheme->setName($config->getTheme()); + $this->get('session')->getFlashBag()->add( 'notice', 'Config saved' -- cgit v1.2.3