Skip to content

Commit

Permalink
[doc] Add "Know issues" about file not uploaded when no change on entity
Browse files Browse the repository at this point in the history
Related to dustin10#123, dustin10#8, ...
  • Loading branch information
gido committed Nov 18, 2013
1 parent d348d7d commit de978b1
Showing 1 changed file with 34 additions and 0 deletions.
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)

0 comments on commit de978b1

Please sign in to comment.