Symfony FileType:class does not work when trying to update

  file-type, forms, symfony

Hi everyone I have a question! How I can solve this problem:

the form’s view data is expected to be an instance of class
SymfonyComponentHttpFoundationFileFile, but is a(n) resource. You
can avoid this error by setting the “data_class” option to null or by
adding a view transformer that transforms a(n) resource to an
instance of SymfonyComponentHttpFoundationFileFile.

This error happens when I try to update it but it doesn’t work with the FileType::class

this is my code:

    namespace XInteractiveBundleLeadsBundleForm;

    use SymfonyComponentFormExtensionCoreTypeFileType;
    use SymfonyComponentFormAbstractType;
    use SymfonyComponentFormFormBuilderInterface;
    use SymfonyComponentOptionsResolverOptionsResolver;
    use XInteractiveBundleLeadsBundleEntityDocument;

    class DocumentType extends AbstractType
        public function buildForm(FormBuilderInterface $builder, array $options)
            ->add('name', null)
            ->add('file', FileType::class);


        public function configureOptions(OptionsResolver $resolver)
                'data_class' => Document::class

Source: Symfony Questions