Feature #3401

Object validation errors don't have a reasonable structure

Added by Christopher Hlubek over 12 years ago. Updated about 11 years ago.

Status:
Resolved
Priority:
Must have
Category:
Validation
Target version:
-
Start date:
2009-05-20
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

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.

#1

Updated by Christopher Hlubek over 12 years ago

  • Tracker changed from Bug to Feature
#2

Updated by Christopher Hlubek over 12 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 over 12 years ago

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

Applied in changeset r2342.

Also available in: Atom PDF