如何在VichUploader中使用两个映射器?

时间:2019-01-08 18:28:51

标签: symfony vichuploaderbundle

我试图在vich_uploader.yaml中使用两个映射器,但是只有第一个起作用了,您能帮我吗?

这是yaml文件:

vich_uploader:
db_driver: orm

mappings:
   descripFileM:
      uri_prefix: /admin/descriptifs/M
      upload_destination: '%kernel.project_dir%/public/admin/descriptifs/M/'


   descripFileL:
      uri_prefix: /admin/descriptifs/L
      upload_destination: '%kernel.project_dir%/public/admin/descriptifs/L/'

第一个映射问题是:

/**
 * @ORM\Column(type="string", length=300, nullable=true)
 */
private $descriptif;

/**
 * @Vich\UploadableField(mapping="descripFileM", fileNameProperty="descriptif")
 * @var File|null
*/
private $descripFile;

第二个问题:

/**
 * @ORM\Column(type="string", length=300, nullable=true)
 */
private $descriptifL;

/**
 * @Vich1\UploadableField(mapping="descripFileL", fileNameProperty="descriptifL")
 * @var File|null
*/
private $descripFileL;

0 个答案:

没有答案