public function postSetData(FormEvent $event)
    {
        $collection = $event->getData();
        $form = $event->getForm();
        
        if ($collection instanceof PersistentCollection){
            
            foreach ($collection as $key => $image){
                if ($image instanceof MultiImageInterface && null !== $image->getId()){
                    try{
                        $this->imageManager->copyImagesToTemporaryDirectory($image);
                    } catch(\Gaufrette\Exception\FileNotFound $e){
                        $form->remove($key);
                        $collection->removeElement($image);
                    }
                    
                }
            }
        }
    }
public function postSetData(FormEvent $event)
    {
        $collection = $event->getData();
        $form = $event->getForm();
        
        if ($collection instanceof PersistentCollection){
            
            foreach ($collection as $key => $image){
                if ($image instanceof MultiImageInterface && null !== $image->getId()){
                    try{
                        $this->imageManager->copyImagesToTemporaryDirectory($image);
                    } catch(\Gaufrette\Exception\FileNotFound $e){
                        $form->remove($key);
                        $collection->removeElement($image);
                    }
                    
                }
            }
        }
    }
public function postSetData ( FormEvent $ event ) { $ collection = $ event -> getData ( ) ; $ form = $ event -> getForm ( ) ; if ( $ collection instanceof PersistentCollection ) { foreach ( $ collection as $ key => $ image ) { if ( $ image instanceof MultiImageInterface && null !== $ image -> getId ( ) ) { try { $ this -> imageManager -> copyImagesToTemporaryDirectory ( $ image ) ; } catch ( \ Gaufrette \ Exception \ FileNotFound $ e ) { $ form -> remove ( $ key ) ; $ collection -> removeElement ( $ image ) ; } } } } }
Copy images from permenent to temporary directory

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