Reputation: 4118
I've chosen to move Form processing from Controller to MyForm class, in order to follow ThinController/FatModel rule. But some of my code in Zend_Form class needs to perform a redirect.
In Zend_Controller_Action my redirect was:
$this->_redirect('/');
What would it become in Zend_Form?
Upvotes: 2
Views: 3161
Reputation: 117467
It's not a model component, if you redirect from within it. You should only do redirects from the presentation layer.
What would be an example of this? Lets suppose that currently I have a simple RecordForm class, and in its init() I am doing redirect after lines where I check record update was successfull.
You could let the function return a value indicating success/failure, and let the caller (the controller) perform a redirect based on the result.
Upvotes: 3
Reputation: 134581
$redirector =
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$redirector->gotoSimple('index','index');
Upvotes: 10