function prefs(Request $request, Application $app) { $form = $app['form.factory']->create(new UserPrefsForm(), $app['currentUser']); if ('POST' == $request->getMethod()) { $form->bind($request); if ($form->isValid()) { $userRepo = new UserAccountRepository(); $userRepo->editPreferences($app['currentUser']); $app['flashmessages']->addMessage("Options Changed."); return $app->redirect("/me/"); } } return $app['twig']->render('index/currentuser/prefs.html.twig', array('form' => $form->createView())); }