Skip to content

Commit 15ccf24

Browse files
committed
fix a case when you set only the file field for the first time
1 parent 53e9b2e commit 15ccf24

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cookbook/doctrine/file_uploads.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,10 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
304304
if (isset($this->path)) {
305305
// store the old name to delete after the update
306306
$this->temp = $this->path;
307+
$this->path = null;
308+
} else {
309+
$this->path = 'initial';
307310
}
308-
$this->path = null;
309311
}
310312

311313
/**
@@ -419,6 +421,8 @@ property, instead of the actual filename::
419421
if (is_file($this->getAbsolutePath())) {
420422
// store the old name to delete after the update
421423
$this->temp = $this->getAbsolutePath();
424+
} else {
425+
$this->path = 'initial';
422426
}
423427
}
424428

0 commit comments

Comments
 (0)