svd_media:
adapter: gaufrette_service_id
base_url: file_folder_url
Add ralation to your entity annotation.
/**
* @OneToOne(targetEntity="File")
* @JoinColumn(name="file_id", referencedColumnName="id")
**/
protected $file;
To form type add media
field
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('file', MediaType::class)
}
To remove unused media from storage, run command:
app/console media:remove-unused