Feature #3401

Object validation errors don't have a reasonable structure

Added by Christopher Hlubek about 6 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2009-05-20
Priority:Must have Due date:
Assigned To:Christopher Hlubek % Done:

100%

Category:Validation
Target version:-
PHP Version: Complexity:
Has patch:

Description

When validating properties of objects with validators, the errors must be nested just like the properties that were validated.

If this is not the case, validation errors cannot be assigned to single properties in after doing the validation. This is needed for the very simple case of displaying input fields with errors in the frontend.

Associated revisions

Revision 03d14776
Added by Christopher Hlubek about 6 years ago

Object validation: Introduced PropertyError for nested errors and changed property mapper and mapping results. Resolves #3401

History

#1 Updated by Christopher Hlubek about 6 years ago

  • Tracker changed from Bug to Feature

#2 Updated by Christopher Hlubek about 6 years ago

A possible solution would be a special Validation\ObjectError class extending Validation\Error that allows for the following structure:

ObjectError(
    'propertyErrors' => array(
        'blog' => array(
            ObjectError(
                'propertyErrors' => array(
                    'title' => array(
                        Error("title too short", 1232423),
                        Error("title has spelling errors", 14324323)
                    )
                )
            )
        )
    )
)

#3 Updated by Christopher Hlubek about 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2342.

Also available in: Atom PDF