views:

474

answers:

2
if ($user->values($_POST)->check())
{
    $user->save();
} else {

 // How can i get the errors?

}

Any idea how that works?

Thanks in advance!

A: 

Ah got it...

if ($user->values($_POST)->check())
{
    $user->save();
} else {

 $errors = $user->validate()->errors();
}
n00b
+2  A: 
$user->_validate()->errors()

or

$user->validate()->errors()

depending on the version you're using.

Or, you can add a method in application/classes/orm.php with this;

class ORM extends Kohana_ORM {

public function errors($file = 'validate', $translate = TRUE)
    {
     return $this->_validate->errors( $file, $translate );
    }

}

and than call errors with $user->errors() , which I find a lot easier

Kemo