Kohana 3 - Get Orme Check Errors

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

 // How can i get the errors?

}

Any idea how this works?

+3
source share
2 answers
$user->_validate()->errors()

or

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

depending on the version you are using.

Or you can add a method to application / classes / orm.php with this:

class ORM extends Kohana_ORM {

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

}

as well as call errors with $ user-> errors (), which I find much easier

+4
source

But it turned out ...

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

 $errors = $user->validate()->errors();
}
+1
source

Source: https://habr.com/ru/post/1743992/


All Articles