function edit($id, Request $request, Application $app) { if (!$this->build($id, $request, $app)) { $app->abort(404, "User Group does not exist."); } $form = $app['form.factory']->create(new UserGroupEditForm($app), $this->parameters['usergroup']); if ('POST' == $request->getMethod()) { $form->bind($request); if ($form->isValid()) { $ugr = new UserGroupRepository(); $meta = new UserGroupEditMetaDataModel(); $meta->setUserAccount($app['currentUser']); $meta->setFromRequest($request); $ugr->editTitleWithMetaData($this->parameters['usergroup'], $meta); return $app->redirect("/admin/usergroup/" . $this->parameters['usergroup']->getId()); } } $this->parameters['form'] = $form->createView(); return $app['twig']->render('site/adminusergroup/edit.html.twig', $this->parameters); }