Answer the question
In order to leave comments, you need to log in
Why doesn't redirect work in Zend Framework 2?
The controller method has a manageAction() method.
I call the fillForm() method in it.
The fillForm() method has a try...catch block, in the catch section of which I add an error message and a redirect.
$this->flashMessenger()->addErrorMessage("Ошибка при работе с API v1.5.");
return $this->redirect()->toRoute('home');
$this->redirect()->toRoute('home');
$this->flashMessenger()->addErrorMessage("Ошибка при работе с API v1.5.");
$this->flashMessenger()->addErrorMessage("Ошибка при работе с API v1.5.");
return $this->redirect()->toRoute('home');
Answer the question
In order to leave comments, you need to log in
Are you sure the catch is working?
And that in $this you have a redirect() method?
Check with a debugger what works for you and what doesn't.
Obviously, you return Responce in the fillForm method, but who will return in manageAction?
public function manageAction()
{
// ...
$ret = $this->fillForm();
if ($ret instanceof Response) {
return $ret;
}
// ...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question