public function submit(FormEvent $event)
    {
        $entity = $event->getData();
        
        if ($entity instanceof FileInterface && null === $entity->getId() && null === $entity->getHash()){
            $event->setData(null);
        }
    }
public function submit(FormEvent $event)
    {
        $entity = $event->getData();
        
        if ($entity instanceof FileInterface && null === $entity->getId() && null === $entity->getHash()){
            $event->setData(null);
        }
    }
public function submit ( FormEvent $ event ) { $ entity = $ event -> getData ( ) ; if ( $ entity instanceof FileInterface && null === $ entity -> getId ( ) && null === $ entity -> getHash ( ) ) { $ event -> setData ( null ) ; } }
Form event - removes file if scheduled.

@param FormEvent $event
Form event - removes file if scheduled .