本文整理汇总了PHP中Symfony\Component\Form\FormInterface::getErrorsAsString方法的典型用法代码示例。如果您正苦于以下问题:PHP FormInterface::getErrorsAsString方法的具体用法?PHP FormInterface::getErrorsAsString怎么用?PHP FormInterface::getErrorsAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\FormInterface
的用法示例。
在下文中一共展示了FormInterface::getErrorsAsString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateRequestParameters
/**
* Takes the request parameters and passes them through the form associated with this controller.
*
* @param Request $request
*
* @throws BadRequestHttpException if the request parameters could not be validated with the form.
*
* @return FormInterface
*/
protected function validateRequestParameters(Request $request)
{
$data = $request->request->all();
if (isset($data['id'])) {
unset($data['id']);
}
// we explicitly do not load existing data; an edit is a PUT and should supply all valid data!
$this->form->submit($data);
if (!$this->form->isValid()) {
throw new BadRequestHttpException($this->form->getErrorsAsString());
}
return $this->form;
}
示例2: convertInvalid
/**
* @param FormInterface $form
*
* @return array
*/
public function convertInvalid(FormInterface $form)
{
return array('errors' => $form->getErrorsAsString());
}
示例3: testValidData
public function testValidData()
{
$this->form->submit($this->formData);
$this->assertTrue($this->form->isValid());
$this->assertEquals('', $this->form->getErrorsAsString());
}