我想用 VichUploaderBundle 上传文件。有我的实体
........
/**
*
* @Vich\UploadableField(mapping="product_image", fileNameProperty="imageName")
*
* @var File $imageFile
*/
protected $imageFile;
/**
* @ORM\Column(type="string", length=255, name="image_name")
*
* @var string $imageName
*/
protected $imageName;
/**
* @ORM\Column(type="datetime")
*
* @var \DateTime $updatedAt
*/
protected $updatedAt;
/**
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
*/
public function setImageFile(File $image = null)
{
$this->imageFile = $image;
if ($image) {
$this->updatedAt = new \DateTime('now');
}
}
/**
* @return File
*/
public function getImageFile()
{
return $this->imageFile;
}
/**
* @param string $imageName
*/
public function setImageName($imageName)
{
$this->imageName = $imageName;
}
/**
* @return string
*/
public function getImageName()
{
return $this->imageName;
}
.........
我的表单生成器看起来像
........
$builder
->add('brand')
->add('model')
->add('price')
->add('imageName')
->add('updatedAt')
->add('sub_rel')
.......
我的配置文件看起来像
vich_uploader:
db_driver: orm
mappings:
product_image:
uri_prefix: /images/goods
upload_destination: %kernel.root_dir%/../web/images/goods
inject_on_load: false
delete_on_update: true
delete_on_remove: true
问题:我需要更改哪些内容才能使用此捆绑包下载一些图片?