diff --git a/controller/upload_file.rst b/controller/upload_file.rst index 8971c6f5806..1c3ed682c1d 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -442,10 +442,14 @@ controller. public function postLoad(LifecycleEventArgs $args) { $entity = $args->getEntity(); - - $fileName = $entity->getBrochure(); - - $entity->setBrochure(new File($this->targetPath.'/'.$fileName)); + + if (!$entity instanceof Product) { + return; + } + + if ($fileName = $entity->getBrochure()) { + $entity->setBrochure(new File($this->targetPath.'/'.$fileName)); + } } }