ProXamer
ProXamer

Reputation: 375

Redirect/forward to another action and sending post parameters in symfony

In my case, I have a small form with login and password, once submitted, the login/pass are used to open an imap conn to retrieve the user's emails, once the array of emails retrieved in the same action, I want to redirect to another action that uses this array for other treatements !

How is that possible? I mean redirection to another action and sending the whole array as post parameter ?

Upvotes: 2

Views: 19118

Answers (2)

Vlad Jula-Nedelcu
Vlad Jula-Nedelcu

Reputation: 1696

Why not put in session? Either $user->setAttribute() or $user->setFlash()

Upvotes: 1

Mikhail
Mikhail

Reputation: 2562

You should use a $this->forward() method $this->getRequest()->setParameter() and in the action.

For example:

  1. in the first action:

    $this->getRequest()->setParameter('emails',array('[email protected]','[email protected]','[email protected]'));
    
    $this->forward('anotherModule','anotherAction');
    
  2. in the another action:

    print_r($this->getRequest()->getParameter('emails'));
    

Upvotes: 10

Related Questions