오류 메시지를 유효성 검사 개체에 추가하려고합니다.Kohana 3.2 Validation_Exception이 오류를 지원하지 않습니다()
오류는 Validation_Exception의 메소드가 아니라고합니다. 저도 알아요. $ e 변수가 모델의 유효성 검사 클래스의 인스턴스가 되겠지만 그게 사실입니다. 내 질문은 어떻게 오류 메시지를 첨부 할 수 있습니다?
오류 :
ErrorException [ Fatal Error ]: Call to undefined method Validation_Exception::errors()
컨트롤러 :
208 // redirect to the user account
209 $this->request->redirect('user/profile');
210 } catch (Validation_Exception $e) {
211 // Get errors for display in view
212 // Note how the first param is the path to the message file (e.g. /messages/register.php)
213 $errors = $e->errors('register/user');
214 // Move external errors to main array, for post helper compatibility
215 $errors = array_merge($errors, (isset($errors['_external']) ? $errors['_external'] : array()));
216 $view->set('errors', $errors);
217 // Pass on the old form values
218 $_POST['password'] = $_POST['password_confirm'] = '';
모델 :
$validation = Validation::factory($fields)
->rules('username', $this->_rules['username'])
->rule('username', array($this, 'username_available'), array(':validation', ':field'))
->rules('email', $this->_rules['email'])
->rule('email', array($this, 'email_available'), array(':validation', ':field'))
->rules('password', $this->_rules['password'])
->rules('password_confirm', $this->_rules['password_confirm']);
//->labels($_labels);
if (Kohana::config('useradmin')->activation_code) {
$validation->rule('activation_code', array($this, 'check_activation_code'), array(':validation', ':field'));
}
if(!$validation->check())
{
throw new Validation_Exception($validation, __('Your registering information is not valid.'));
}
이 오류가 accuring 왜 난 정말 볼 수 없습니다.
[참고 -이 오류는 PHP에서 무엇을 의미합니까?] (http://stackoverflow.com/q/12769982/367456) – hakre