Skip to content

[Form] property path for violations is incorrect #3995

Closed
@Burgov

Description

@Burgov

I have the following situation:

There is a form which shows a list of entities of some kind, kind of similar to a collection form. However, the entities need to be shown in some kind of hierarchy, so even though the app Data is a plain array, the clientData and form it self are built in the following way:

form:
  Mon:
    0: entity
    1: entity
  Tue:
    0: entity

etc...

The transformation between the two is done using a DataTransformer on the topmost form: https://gist.github.com/2419554

The form works fine except for validation, for some reason all errors bubble up all the way to the top form, even if they should display on the bottom forms (form.Mon.0, form.Mon.1, etc). While trying to find out what was wrong, I came to the conclusion that the property path of the violations was incorrect, or at least not conform to the way the form was build up:

data[0].field
data[0].field2
data[1].field

rather than

data[Mon][0].field
data[Mon][0].field2
data[Mon][1].field

This causes them to bubble all the way up, as they cannot be mapped to the form.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FormGood first issueIdeal for your first contribution! (some Symfony experience may be required)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions