コード例 #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
ファイル: Front.php プロジェクト: akiu/silex-perpustakaan
 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]);
     }
 }