File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -218,8 +218,20 @@ public function postSubmit(FormEvent $event)
218218 $ form = $ event ->getForm ();
219219 $ data = $ form ->getParent ()->getData ();
220220
221+ $ current = $ form ;
222+ $ isAllValid = true ;
223+
224+ // check recuresively this form and all it's parents
225+ do {
226+ if (!$ current ->isValid ()) {
227+ $ isAllValid = false ;
228+ break ;
229+ }
230+ $ current = $ current ->getParent ();
231+ } while (null !== $ current );
232+
221233 $ getter = 'get ' .ucfirst ($ this ->propertyName );
222- if (!$ form -> isValid () && $ data ->$ getter () instanceof ArrayCollection) {
234+ if (!$ isAllValid && $ data ->$ getter () instanceof ArrayCollection) {
223235 // remove files absent in the original collection
224236 $ data ->$ getter ()->clear ();
225237
You can’t perform that action at this time.
0 commit comments