Giving array as parameter using redirect()

[size="2"]Hi guys, I fail giving an array as parameter using method redirect() getting following Exception




Bad request(404):

Invalid data for parameter "Mailadresses"



var_dump on $Mailadresses shows this:




array(2) { [0]=> string(22) "goetz.bewerber@gmx.net" [1]=> string(25) "zetkin.bewerber@gmail.com" } 



Any ideas, how to give array as parameter to actionMethod in Controller?

[/size][font=“Arial,”][size=“2”]P.S.: If my intention can’t be implemented using redirect(), which method sholud be used? Note,that actionMethod is in another class[/size][/font]

[font=“Arial,”][size=“2”]Rephrasing question: I want to achieve sending mails from class MailAusgangController. Mailadresses are in database and will be collected from class BewerberController by Users choice through CheckboxColumns.CheckboxColumns will give me id respectively Mailadresses. Class MailAusgangController doesn’t know anything about this, that’s why I have to give these informations as an array[/size][/font]

[color="#242729"][font="Arial,"][size="2"]Here is code of redirecting-class[/size][/font][/color]

[color="#242729"][font="Arial,"][size="2"]




public function actionCollectMailAdresses() {

        $session = new Session();

        $Mailadresses = array();

        $x = 0;

   	try {

            $checkbox = (array) Yii::$app->request->post('selection');

            if (empty(($checkbox)) && (isset($_POST['button_checkBoxes']))) {

   			$session->addFlash("warning", "Selektieren Sie die Bewerber, für die Mails erstellt werden sollen, über die Checkboxen");

   			return $this->redirect(['/bewerber/bewerber/index']);

            }

                      foreach ($checkbox as $item) {

                $id_person = Bewerber::findOne(['id' => $item])->id_person;

                $IdEKontakt = EKontakt::findOne(['id_person' => $id_person])->id;

   			$mailAdress = KontaktMail::findOne(['id_e_kontakt' => $IdEKontakt]);

                if (empty($mailAdress)) {

                    $session->addFlash("warning", "Für mindestens einer der Bewerber ist im System keine Mailadresse hinterlegt.<br>Überprüfen Sie bitte die Tabellenspalte Bewerber/Kandidat auf Mailadressen");

   				return $this->redirect(['/bewerber/bewerber/index']);[/size][/font][/color]

   			} else {

                    $mailAdress = KontaktMail::findOne(['id_e_kontakt' => $IdEKontakt])->mail;

                    $Mailadresses[$x] = $mailAdress;

                    $x++; 

   			}

            }

   		return $this->redirect(['/mail/mail-ausgang/stapelmail', 'Mailadresses' => $Mailadresses]);

   	} catch (\Exception $error) {

            $go_back = "/bewerber/bewerber/index";

            error_handling::error_without_id($error, $go_back);

   	}  

 }



[/size][/font][/color]

[font="Arial, Helvetica Neue, Helvetica, sans-serif"] [/font]

This thread has been solved at Stackoverflow here

So, this thread will be canceled.

Still unsoved threads can be found here as well as here