I'm trying to upload photos in my easyadmin but i have many errors!the last one is: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'image' in 'field list'
Here is my code:
public function configureFields(string $pageName): iterable
{
return [
TextField::new('nom'),
TextField::new('code'),
TextField::new('imageFile')->setFormType(VichImageType::class)->onlyWhenCreating(),
ImageField::new('image')->setBasePath('/images/dossier')->onlyOnIndex(),
];
}
My Entity related to image:
/** * @ORM\Column(type="string", length=255) * @var string */
private $image;
/**
* @Vich\UploadableField(mapping="dossier_images", fileNameProperty="image")
* @var File
*/
private $imageFile;
service.yaml
parameters:
dossier_images: /images/dossier
vich_uploader.yaml
mappings:
dossier_images:
uri_prefix: '%dossier_images%'
upload_destination: '%kernel.project_dir%/public/%dossier_images%'