public function postSetData(FormEvent $event)
    {
        $collection = $event->getData();
        $form = $event->getForm();

        if ($collection instanceof PersistentCollection){
            foreach ($collection as $key => $file){
                if ($file instanceof MultiFileInterface){
                    try {
                        $this->fileManager->copyFileToTemporaryDirectory($file);
                    } catch (\Gaufrette\Exception\FileNotFound $e) {
                        $form->remove($key);
                        $collection->removeElement($file);
                    }
                }
            }
        }
    }
public function postSetData(FormEvent $event)
    {
        $collection = $event->getData();
        $form = $event->getForm();

        if ($collection instanceof PersistentCollection){
            foreach ($collection as $key => $file){
                if ($file instanceof MultiFileInterface){
                    try {
                        $this->fileManager->copyFileToTemporaryDirectory($file);
                    } catch (\Gaufrette\Exception\FileNotFound $e) {
                        $form->remove($key);
                        $collection->removeElement($file);
                    }
                }
            }
        }
    }
public function postSetData ( FormEvent $ event ) { $ collection = $ event -> getData ( ) ; $ form = $ event -> getForm ( ) ; if ( $ collection instanceof PersistentCollection ) { foreach ( $ collection as $ key => $ file ) { if ( $ file instanceof MultiFileInterface ) { try { $ this -> fileManager -> copyFileToTemporaryDirectory ( $ file ) ; } catch ( \ Gaufrette \ Exception \ FileNotFound $ e ) { $ form -> remove ( $ key ) ; $ collection -> removeElement ( $ file ) ; } } } } }
Copy file from permenent to temporary directory

@param FormEvent $event
Copy file from permenent to temporary directory