0

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%'
2
  • have you updated the db schema? Commented Jul 22, 2021 at 7:37
  • Oh my god no! :D thanks DonCallisto Commented Jul 22, 2021 at 7:42

1 Answer 1

0

Looks like you forgot to run bin/console doctrine:schema:update --force

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.