本文整理汇总了PHP中ValidationResult::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP ValidationResult::getError方法的具体用法?PHP ValidationResult::getError怎么用?PHP ValidationResult::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidationResult
的用法示例。
在下文中一共展示了ValidationResult::getError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetErrorWarningWithMultiple
/**
* @expectedException PHPUnit_Framework_Error_Notice
* @expectedExceptionDescription There are multiple errors, returning only the first
*/
public function testGetErrorWarningWithMultiple()
{
$validation = new ValidationResult();
$validation->addError("Foo");
$validation->addError("Bar");
$validation->getError();
}
示例2: addUserInput
public function addUserInput($post, $data = NULL)
{
if (!$data) {
$data = $this->record->getData($this->getPage());
}
foreach ($post as $key => $value) {
if ($key == 'page') {
continue;
}
$page = substr($key, 0, strpos($key, "-"));
// Split out class and name from input field
$fieldName = substr($key, strpos($key, "-") + 1);
if ($page == $this->getPage()) {
// Checks that the input is from the right page
$valRules = $this->getValRules($page, $fieldName);
if (!emptyInput($value)) {
if ($valRules) {
$vR = new ValidationRules();
$vR->addRulesFromDB($valRules);
$record = isset($this->record) ? $this->record : $data;
$valid = new ValidationResult($value, $vR, $record);
$value = $valid->getValue();
if ($valid->isValid()) {
$data->set($fieldName, $value);
} else {
if (!is_array($valid->getValue())) {
$_SESSION['inputErr'][$key]['value'] = $valid->getValue();
} else {
$_SESSION['inputErr'][$key]['value'] = false;
// Allows marking an error without reproducing the error value
}
$_SESSION['inputErr'][$key]['error'] = $valid->getError();
if ($valid->getVarType() == 'password') {
$_SESSION['error'] = $valid->getError();
}
}
} else {
$data->set($fieldName, $value);
}
}
}
}
if (!($complete = $this->checkComplete($this->getPage(), $data))) {
// Check to see if the object is complete, if so then set it as complete, if not then add a missingData field to inputErr
$_SESSION['inputErr']['missingData'] = true;
// This ensures mandatory data missing is shown
}
$nextPage = $complete && !isset($_SESSION['inputErr']);
return $nextPage;
}