function editDetails($slug, Request $request, Application $app) { if (!$this->build($slug, $request, $app)) { $app->abort(404, "Group does not exist."); } if ($this->parameters['group']->getIsDeleted()) { die("No"); // TODO } $form = $app['form.factory']->create(new GroupEditForm($app), $this->parameters['group']); if ('POST' == $request->getMethod()) { $form->bind($request); if ($form->isValid()) { $groupEditMetaDataModel = new GroupEditMetaDataModel(); $groupEditMetaDataModel->setUserAccount($app['currentUser']); if ($form->has('edit_comment')) { $groupEditMetaDataModel->setEditComment($form->get('edit_comment')->getData()); } $groupRepository = new GroupRepository(); $groupRepository->editWithMetaData($this->parameters['group'], $groupEditMetaDataModel); return $app->redirect("/group/" . $this->parameters['group']->getSlugForUrl()); } } $this->parameters['form'] = $form->createView(); return $app['twig']->render('site/group/edit.details.html.twig', $this->parameters); }