예제 #1
0
파일: Front.php 프로젝트: akiu/perpus-silex
 public function signupAction(Request $request)
 {
     $user = new User();
     $signup = new SignupAction($this->app);
     $form = $this->app['form.factory']->create(new SignupType(), $user);
     if ($request->getMethod() == "POST") {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $signup->handle($user);
             return $this->app['twig']->render('success.html');
         } else {
             return $this->app['twig']->render('signup.html', array('form' => $form->createView()));
         }
     } else {
         return $this->app['twig']->render('signup.html', array('form' => $form->createView()));
     }
 }
예제 #2
0
 public function signupAction(Request $request)
 {
     $user = new User();
     $signup = new SignupAction($this->app);
     $categories = GetAllCategoriesHelper::help(1);
     $form = $this->app['form.factory']->create(new SignupType(), $user);
     if ($request->getMethod() == "POST") {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $signup->handle($user);
             return $this->app['twig']->render('success.html', ['categories' => $categories]);
         } else {
             return $this->app['twig']->render('signup.html', ['form' => $form->createView(), 'categories' => $categories]);
         }
     } else {
         return $this->app['twig']->render('signup.html', ['form' => $form->createView(), 'categories' => $categories]);
     }
 }