public function preSubmitData(FormEvent $event)
    {
        $form = $event->getForm();
        $data = $event->getData();

        if (null === $data || '' === $data) {
            $data = array();
        }

        foreach ($form as $name => $child) {
            if (!isset($data[$name])) {
                $form->remove($name);
            }
        }
    }
public function preSubmitData(FormEvent $event)
    {
        $form = $event->getForm();
        $data = $event->getData();

        if (null === $data || '' === $data) {
            $data = array();
        }

        foreach ($form as $name => $child) {
            if (!isset($data[$name])) {
                $form->remove($name);
            }
        }
    }
public function preSubmitData ( FormEvent $ event ) { $ form = $ event -> getForm ( ) ; $ data = $ event -> getData ( ) ; if ( null === $ data || '' === $ data ) { $ data = array ( ) ; } foreach ( $ form as $ name => $ child ) { if ( ! isset ( $ data [ $ name ] ) ) { $ form -> remove ( $ name ) ; } } }
Pre submit data.

@param FormEvent $event
Pre submit data .