Skip to content

[Form] "error_mapping" on child with "inherit_data" has no effect #8818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
webmozart opened this issue Aug 21, 2013 · 5 comments
Open

[Form] "error_mapping" on child with "inherit_data" has no effect #8818

webmozart opened this issue Aug 21, 2013 · 5 comments

Comments

@webmozart
Copy link
Contributor

Given the following form:

$form = $factory->createBuilder()
    ->add('foo', null, array(
        'inherit_data' => true,
        'error_mapping' => array(
            'bar' => 'baz',
        ),
    ))
    ->getForm();

$form->get('foo')->add('baz');

then if a an error occcurs on the property path "bar", it won't be mapped to "baz", because the "error_mapping" setting on form "foo" (which inherits its parent data) is not regarded.

@lavoiesl
Copy link
Contributor

Taken from the comments (written by @fabpot)

https://github.com/symfony/symfony/blob/eb9f76d5/src/Symfony/Component/Form/Form.php#L560

        // Forms that inherit their parents' data also are not processed,
        // because then it would be too difficult to merge the changes in
        // the child and the parent form. Instead, the parent form also takes
        // changes in the grandchildren (i.e. children of the form that inherits
        // its parent's data) into account.
        // (see InheritDataAwareIterator below)

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@xabbuh
Copy link
Member

xabbuh commented Jan 1, 2021

Status: Reviewed

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@Nek-
Copy link
Contributor

Nek- commented Oct 15, 2021

Isn't this fixed by #39670 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants