Skip to content

Commit

Permalink
Update known_issues.md
Browse files Browse the repository at this point in the history
Add 'instanceof'  check as written here: dustin10#8 (comment) to avoid this issue dustin10#297 (comment)
  • Loading branch information
Mondane committed Jun 30, 2015
1 parent d6a9730 commit 081e2dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Resources/doc/known_issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ is the only updated.
A workaround to solve this issue is to manually generate a change:

```php
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class Product
{
// ...
Expand All @@ -23,11 +26,13 @@ class Product

// ...

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

if ($this->image) {
// Only change the updated af if the file is really uploaded to avoid database updates.
// This is needed when the file should be set when loading the entity.
if ($this->image instanceof UploadedFile) {
$this->updatedAt = new \DateTime('now');
}
}
Expand Down

0 comments on commit 081e2dd

Please sign in to comment.