Skip to content

Commit 1e24827

Browse files
committed
fix php warning
1 parent cc992cc commit 1e24827

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cookbook/doctrine/file_uploads.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ object, which is what's returned after a ``file`` field is submitted::
188188
public function upload()
189189
{
190190
// the file property can be empty if the field is not required
191-
if (!$this->file) {
191+
if (empty($this->file)) {
192192
return;
193193
}
194194

@@ -245,7 +245,7 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
245245
*/
246246
public function preUpload()
247247
{
248-
if ($this->file) {
248+
if (!empty($this->file)) {
249249
// do whatever you want to generate a unique name
250250
$this->setPath(uniq().'.'.$this->file->guessExtension());
251251
}
@@ -256,7 +256,7 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
256256
*/
257257
public function upload()
258258
{
259-
if (!$this->file) {
259+
if (empty($this->file)) {
260260
return;
261261
}
262262

@@ -303,7 +303,7 @@ property, instead of the actual filename::
303303
*/
304304
public function preUpload()
305305
{
306-
if ($this->file) {
306+
if (!empty($this->file)) {
307307
$this->setPath($this->file->guessExtension());
308308
}
309309
}
@@ -313,7 +313,7 @@ property, instead of the actual filename::
313313
*/
314314
public function upload()
315315
{
316-
if (!$this->file) {
316+
if (empty($this->file)) {
317317
return;
318318
}
319319

0 commit comments

Comments
 (0)