0

我正在尝试在我的easyadmin中上传照片,但我有很多错误!最后一个是:SQLSTATE [42S22]:找不到列:1054 '字段列表'中的未知列'图像'

这是我的代码:

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(),
           ];
}

与图像相关的我的实体:

/** * @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%'
4

1 回答 1

0

看起来你忘记跑步了bin/console doctrine:schema:update --force

于 2021-07-23T11:06:24.023 回答