Skip to content

Commit e9a4318

Browse files
committed
minor #7494 Minor fix in postLoad event (file uploading) (Prisacari Dmitrii)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #7494). Discussion ---------- Minor fix in `postLoad` event (file uploading) Minor fix in `postLoad` event (file uploading). Added accessor methods in FileUploader class to make it possible to get $targetDir from outside. Commits ------- f16d3ed Minor fix in event (file uploading)
2 parents 2ad94ff + f16d3ed commit e9a4318

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

controller/upload_file.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ logic to a separate service::
247247

248248
return $fileName;
249249
}
250+
251+
public function getTargetDir()
252+
{
253+
return $this->targetDir;
254+
}
250255
}
251256

252257
Then, define a service for this class:
@@ -447,9 +452,13 @@ controller.
447452
{
448453
$entity = $args->getEntity();
449454

455+
if (!$entity instanceof Product) {
456+
return;
457+
}
458+
450459
$fileName = $entity->getBrochure();
451460

452-
$entity->setBrochure(new File($this->targetPath.'/'.$fileName));
461+
$entity->setBrochure(new File($this->uploader->getTargetDir().'/'.$fileName));
453462
}
454463
}
455464

0 commit comments

Comments
 (0)