In short: newer in view.
You may eventually:
- create view helper for complex tasks (and call the helper in view
$this->getForm()
),
- or use
Model::getForm()
- or
service::getForm()
when you need cross-action forms.
Further explanation:
Because in the ideal case, views contain only HTML, to separate logic from presentation (MVC).
When using TDD, you write tests for logic, never for view scripts, which are only clothes for the variables.
Displaying the form, is not only the form itself, but also checking whether it was submitted or not, checking for validation errors, setting flash messenger variables and much more.
These are too complex tasks for putting them to view scripts.
As a good exercise on separating logic and presentation, I recommend you to take a look at PHPTAL template language, which is a nice alternative to native PHP as a template language used in ZF.