public function preSetData(FormEvent $event)
    {
        $entity = $event->getData();
    
        if ($entity instanceof FileInterface && null !== $entity->getId()){
            try {
                $this->fileManager->copyFileToTemporaryDirectory($entity);
            } catch (\Gaufrette\Exception\FileNotFound $e) {
                $event->setData(null);
            }
        }
    }
public function preSetData(FormEvent $event)
    {
        $entity = $event->getData();
    
        if ($entity instanceof FileInterface && null !== $entity->getId()){
            try {
                $this->fileManager->copyFileToTemporaryDirectory($entity);
            } catch (\Gaufrette\Exception\FileNotFound $e) {
                $event->setData(null);
            }
        }
    }
public function preSetData ( FormEvent $ event ) { $ entity = $ event -> getData ( ) ; if ( $ entity instanceof FileInterface && null !== $ entity -> getId ( ) ) { try { $ this -> fileManager -> copyFileToTemporaryDirectory ( $ entity ) ; } catch ( \ Gaufrette \ Exception \ FileNotFound $ e ) { $ event -> setData ( null ) ; } } }
Copy media to temporary directory

@param FormEvent $event
@return void
Copy media to temporary directory