Skip to content

Commit

Permalink
minor additions for Symfony's kind of upload handling, refs #541
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Nov 7, 2016
1 parent 61b5072 commit c2fc48b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1285,8 +1285,11 @@ class FormHandler {
«ENDIF»
«locking.imports(it
«IF !app.isLegacy»
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
«IF hasUploadFieldsEntity»
use Symfony\Component\HttpFoundation\File\File;
«ENDIF»
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use ModUtil;
use RuntimeException;
use System;
Expand Down Expand Up @@ -1360,6 +1363,15 @@ class FormHandler {
«ENDIF»
}
}
«IF !app.isLegacy && hasUploadFieldsEntity»

// file field type expects File instances instead of file names
$controllerHelper = $this->container->get('«app.appService».controller_helper');
foreach ($this->uploadFields as $uploadFieldName => $isMandatory) {
«FOR uploadField : getUploadFieldsEntity»
$entity[$uploadFieldName] = new File($controllerHelper->getFileBaseFolder($this->objectType, $uploadFieldName) . $entity[$uploadFieldName]);
«ENDFOR»
«ENDIF»

return $entity;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ class ModelExtensions {
TextField: 'text'
EmailField: 'string'
UrlField: 'string'
UploadField: if (entity.application.targets('1.3.x')) 'string' else 'File'
UploadField: 'string'
ListField: 'string'
ArrayField: 'array'
ObjectField: 'object'
Expand Down

0 comments on commit c2fc48b

Please sign in to comment.