@@ -49,8 +49,7 @@ file contents.
49
49
The next step is to add a new field to the form that manages the ``Product ``
50
50
entity. This must be a ``FileType `` field so the browsers can display the file
51
51
upload widget. The trick to make it work is to add the form field as "unmapped",
52
- so Symfony doesn't try to get/set its value from the ``brochureFilename `` entity
53
- property::
52
+ so Symfony doesn't try to get/set its value from the related entity::
54
53
55
54
// src/AppBundle/Form/ProductType.php
56
55
namespace AppBundle\Form;
@@ -146,7 +145,7 @@ Finally, you need to update the code of the controller that handles the form::
146
145
/** @var UploadedFile $brochureFile */
147
146
$brochureFile = $form['brochure']->getData();
148
147
149
- // this condition is required because the 'brochure' field is not required
148
+ // this condition is needed because the 'brochure' field is not required
150
149
// so the PDF file must be processed only when a file is uploaded
151
150
if ($brochureFile) {
152
151
$originalFilename = pathinfo($brochureFile->getClientOriginalName(), PATHINFO_FILENAME);
@@ -164,7 +163,7 @@ Finally, you need to update the code of the controller that handles the form::
164
163
// ... handle exception if something happens during file upload
165
164
}
166
165
167
- // updates the 'brochure ' property to store the PDF file name
166
+ // updates the 'brochureFilename ' property to store the PDF file name
168
167
// instead of its contents
169
168
$product->setBrochureFilename($newFilename);
170
169
}
0 commit comments