akeneo/pim-community-dev — pull request #664 by gquemener (2014-01-24 10:41:09+00:00)
Title: Prevented the form subscriber to remove form fields if not valid

```
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Unit test passes: yes
Specs passes: yes
Replaced unit test classes removed: yes
Behat scenario passes: ?
Checkstyle issues: no
ChangeLog updated: yres
Documentation PR:
Fixes the following jira:
- PIM-1892
```

Some product form fields are not directly displayed (like associations and family) because they are "lazy" loaded through ajax. Thus, to prevent setting their value to `null` while submitting the product form, we created a form subscriber that removes thoses missing fields (`Pim\Bundle\CatalogBundle\Form\Subscriber\IgnoreMissingFieldDataSubscriber`).

Problem was that, form is reused after submitting if there are constraint violations, but then with some missing fields, leading to template issue (`FormView has no family attribute`).

Solution is to remove thoses missing fields only when the form is valid.