Skip to content

Commit b313b37

Browse files
committed
Fix filter path null error
1 parent 11d6200 commit b313b37

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Form/EventListener/CollectionUploadSubscriber.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)