piwi91/form-handler
最新稳定版本:v1.0.0
Composer 安装命令:
composer require piwi91/form-handler
包简介
A Form Handler implementation for the Symfony Form Component
README 文档
README
This is a Form Handler implementation which I used in combination with the Symfony Form component.
Click here to go to the blog post I wrote about the form handler.
Usage
Implement the FormHandlerInterface OR extend the AbstractFormHandler and implement the postProcess method.
You can use a try/catch to catch validation exceptions.
Example:
public function anActionInAController(Request $request)
{
$formHandler = new MyFancyFormHandler($formFactory, $form);
$form = $formHandler->form();
if ($request->isMethod('POST') {
try {
$formHandler->process($form, $request);
} catch (ValidationException $e) {
// Do something with the validation... or not ;-) (and render the page including the validation errors)
}
}
return $this->render('my_view.html.twig', ['form' => $form->createView()]);
}
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-27