예제 #1
0
 /**
  * @param Request $request
  * @param Application $app
  * @param $idbio
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function addAction(Request $request, Application $app, $idbio)
 {
     $skill = new skill();
     $skill->setBio($idbio);
     $skillForm = $app['form.factory']->create(new SkillForm(), $skill);
     $skillForm->handleRequest($request);
     if ($skillForm->isValid()) {
         $this->repository['skillRepository']->save($skill);
         $app['session']->getFlashBag()->add('success', 'The skill was successfully created.');
         return $app->redirect($app["url_generator"]->generate('listBio'));
     }
     return $app['twig']->render('Pages/Skill/Add.html.twig', array('title' => 'New skill', 'skillForm' => $skillForm->createView()));
 }