Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Add "Know issues" about file not uploaded when no change on entity #167

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Resources/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,3 +429,37 @@ vich_uploader:
store files. The bundle ships with vich_uploader.storage.file_system
and vich_uploader.storage.gaufrette see
[FileSystemStorage VS GaufretteStorage](#filesystemstorage-vs-gaufrettestorage)

## Know issues

### The file is not updated if there are not other changes in the entity
As the bundle is listen on Doctrine event `prePersist` and `preUpdate`, which are not fired
when there is no change on field mapped by Doctrine, the file upload is not handled.

A workaround to solve this issue is to manually generate a change:

```
class Product
{
// ...

/**
* @ORM\Column(type="datetime")
*
* @var \DateTime $updatedAt
*/
protected $updatedAt;

// ...

public function setImage($image)
{
$this->image = $image;

if ($this->image) {
$this->updatedAt = new \DateTime('now');
}
}
}
```
See issue [GH-123](https://github.com/dustin10/VichUploaderBundle/issues/123)