没有能够为 "vich_uploader" 加载配置的扩展程序

There is no extension able to load the configuration for "vich_uploader"

我想在我的简单管理界面中使用 vich 上传器。安装后,我创建了 vich_uploader.yaml 文件(在我的例子中它不是单独生成的)。 我已经按照 symfony 页面中的教程进行操作,但是当我想使用它时,出现了错误:

"There is no extension able to load the configuration for "vich_uploader""

我真的不明白为什么,这是我的文件:

easy_admin.yaml :

easy_admin:
    entities:
      Project:
        list:
          fields:
            - { property: 'photo_1', type: 'image', base_path: '%app.path.project_images%' }
        show:
          fields:
            - { property: 'photo_1', type: 'image', base_path: '%app.path.project_images%' }
        form:
          fields:
            - {property: 'photo_1File', type: 'vich_image'}

vich_uploader.yaml :

vich_uploader:
  db_driver: orm
  mappings:
    project_images:
      uri_prefix:         '%app.path.project_images%'
      upload_destination: '%kernel.project_dir%/public%app.path.project_images%'

我的项目实体看起来像:

/**
 * @ORM\Entity(repositoryClass=ProjectRepository::class)
 * @Vich\Uploadable
 */
class Project
{
/**
     * @ORM\Column(type="string", length=255, nullable=true)
     * @var string
     */
    private $photo_1;

/**
     * @Vich\UploadableField(mapping="project_images", fileNameProperty="photo_1")
     * @var File
     */
    private $photo_1File;

public function getPhoto1(): ?string
    {
        return $this->photo_1;
    }

public function setPhoto1(?string $photo): self
    {
        $this->photo_1 = $photo;

        return $this;
    }

public function setPhoto1File(File $image = null)
    {
        $this->photo_1File = $image;
        if ($image) {
            $this->updatedAt = new \DateTime('now');
        }
    }
public function getPhoto1File()
    {
        return $this->photo_1File;
    }

services.yaml :

parameters:
    app.path.project_images: /uploads/images/projects

我的 composer.json 中有行 "vich/uploader-bundle": "^1.15"。看来 symfony 没有找到包...

添加到bundles.php:

Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true],

这将为所有环境激活捆绑包,不仅是开发和测试,否则它将无法在实时环境中使用