Bug Report #3586

The validation exception does not properly namespace errors

Added by Lorenzo Pisani over 1 year ago. Updated over 1 year ago.

Status:Closed Start date:01/14/2011
Priority:High Due date:
Assignee:Lorenzo Pisani % Done:

0%

Category:-
Target version:Kohana v3.x - v3.1.0
Resolution:fixed Points:

Description

$e->errors('directory'); is completely broken at the moment. Seems some code refactoring broke the feature.

Given the following errors from the User model:

array(
    'username' => 'not_empty',
    'user_profile' => array(
        'first_name' => 'max_length',
    ),
);

$e->errors('model-validation'); should check the following paths in order and stop as soon as a value is found (last one on the list is the default text returned):
array(
    // messages/user.php
    //    username.not_empty
    //    username.default
    //    not_empty
    // messages/validation.php
    //    not_empty
    // 'user.username.not_empty'
    'username' => 'not_empty',
    'user_profile' => array(
        // messages/user/user_profile.php
        //    first_name.max_length
        //    first_name.max_length
        //    max_length
        // messages/validation.php
        //    max_length
        // 'user.username.not_empty'
        'first_name' => 'max_length',
    ),
);

I will fix this in a pull request today

Associated revisions

Revision b717bb70
Added by Lorenzo Pisani over 1 year ago

Fixed the recursive generate_errors() method for orm validation exceptions, fixes #3586

History

Updated by Isaiah DeRose-Wilson over 1 year ago

  • Status changed from New to Closed
  • Resolution set to fixed

Fixed by b717bb7033...

Also available in: Atom PDF