Вот код:
try {
$result = Model_User::update_user($_POST);
// message: save success
Message::add('success', __('Values saved.'));
// redirect and exit
$this->request->redirect('user/profile');
return;
} catch (Exception $e) {
// Get errors for display in view
// Note how the first param is the path to the message file (e.g. /messages/register.php)
Message::add('error', __('Error: Values could not be saved.'));
$errors = $e->errors('register');
$errors = array_merge($errors, (isset($errors['_external']) ? $errors['_external'] : array()));
$view->set('errors', $errors);
// Pass on the old form values
$user->password = '';
$view->set('data', $user);
}
Вот код метода update_user в Model_User:
public function update_user($fields)
{
$validation = Validation::factory($fields)
->rules('password', $this->_rules['password'])
->rules('password_confirm', $this->_rules['password_confirm'])
->filters('password', $this->_filters['password']);
$this->validate($fields);
$users = CASSANDRA::selectColumnFamily('Users');
if ($users->get_cout($username))
{
return $users->insert($uuid, array(
'username' => $fields['username'],
'password' => $fields['password'],
'email' => $fields['email'],
'modify' => date('YmdHis', time()),
));
}
else
{
return $validation;
}
}
Я сейчас получаю эту ошибку:
ErrorException [ Fatal Error ]: Call to undefined method ErrorException::errors()
Застрял в этой строке:
117 $errors = $e->errors('register');
Заранее спасибо за любую помощь!