Symfony2 Multiple forms on one page
===

So I want to make a page with a sign in (log in) form and a sign up (registration) form with Symfony2. And I'm wondering what would be the best way to achieve this?

I've considered setting the form attribute `action="/pathToMyFormProcess"` but I then face a problem: I want to show the same template (HTML page) in that action. But the "/pathToMyFormProcess" would be called in many different actions with different templates. Like a log in form that is included or rendered on every page. I could make a new path and action for every template. But as this example shows it would be very frustrating:


My signup action would be:

    public function signupAction() {
        
        $loginForm = $this->get('loginform'); // Get the login form
        $signUpForm = $this->get('signupform'); // Get the signup form
        
        $loadData = ... /* Loading data needed for this page (could be last visitors, 
       countries, some information from database that should be displayed on the page) */
        
        return // SIGNUPTEMPLATE - array ( forms and data )
        
    }

Then if someone used the loginform it would send them to for example /signup/login with the action loginAction in SignupController for example.

    public function signupAction() {
        
        $loginForm = $this->get('loginform'); // Get the login form
        $handler = $this->get('loginhandler'); // Get the handler

        $process = $handler->process(); // Process the request, try to log in basicly.
        if($process) {
          return // redirect or something - no problem
        }

        // Loading again, writing exact same code as signupAction()
        $signUpForm = $this->get('signupform'); // Get the signup form
        
        $loadData = ...

        return // SIGNUPTEMPLATE - array ( forms and data )
    }


So I am wondering if you have any better ideas for how to achieve this?

Thanks in advance

