本文整理匯總了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());
}