VichUploaderBundle: delete_on_update not working
Bug Report
| Q | A |
|---|---|
| BC Break | no |
| Bundle version | dev-master |
| Symfony version | 6.0.1 |
| PHP version | 8.0.14 |
Hello everyone,
It seems that the delete_on_update parameter is not working correctly, at least not in my case with the dev-master version. Strange because the delete_on_remove parameter works very well.
#[Vich\Uploadable]
class PageImageBlock
{
#[Vich\UploadableField(mapping: 'page_image', fileNameProperty: 'imageName')]
private ?File $imageFile = null;
#[ORM\Column(type: 'string', length: 255)]
private ?string $imageName = null;
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageFile(?File $imageFile): self
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
$this->updatedAt = new DateTime();
}
return $this;
}
public function getImageName(): ?string
{
return $this->imageName;
}
public function setImageName(?string $imageName): self
{
$this->imageName = $imageName;
return $this;
}
}
vich_uploader:
db_driver: orm
metadata:
type: attribute
mappings:
page_image:
uri_prefix: '%app.path.page_image%'
upload_destination: '%kernel.project_dir%/public%app.path.page_image%'
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer
Do you have an idea ?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 47 (11 by maintainers)
@garak Yes, I confirm ! It works perfectly for me now ๐
@garak Hi,
I just launched a new symfony 6.0.2 project in which I simply installed and configured the bundle and I still have the same problem. I created a repository with the code Iโm talking about so you can maybe see if the cause is me or the bundle ^^.
https://github.com/julien-lmnr/vich-issue1252
Can anyone try if the fix proposed in #1285 is solving this issue? I hope so, since I just reverted the behaviour to the old one.
@garak Good news, I have downgraded to 1.18 and it works! So, the problem must be somewhere in https://github.com/dustin10/VichUploaderBundle/compare/1.18.0...1.19.0
I am checking the diffs, but could you have a look too?
Same with me SF 5.4.2 VichUploader 1.19.0
@julien-lmnr Thanks, nice you did it ๐
@Jupi007 I guess itโs related to other dependencies. Try to upgrade all your vendors. If you still experience this problem, please create a minimal application when itโs possible to reproduce it systematically.
Hi, it looks like I also have this problem. Using Sf 5.4 and VichUploaderBundle 1.19
delete_on_remove works but not delete_on_update.