/** * Get the form object for the current action. * * @api * * @return form\Form */ protected final function getForm() { $class = str_replace('\\controller\\', '\\form\\', str_replace('Controller', 'Form', get_called_class())); $action = Router::getAction(); $form = new $class(); $form->{$action}(); return $form; }