Php TYPO3流中的多个文件上载

Php TYPO3流中的多个文件上载,php,doctrine-orm,many-to-many,relationship,typo3-flow,Php,Doctrine Orm,Many To Many,Relationship,Typo3 Flow,我需要在TYPO3流中支持文件上传()的多个属性。这就是我到目前为止所做的 我有一个具有资源集合的实体: /** * @var \Doctrine\Common\Collections\Collection<\TYPO3\Flow\Resource\Resource> * @ORM\ManyToMany(cascade={"all"}) * @ORM\JoinTable(inverseJoinColumns={@ORM\JoinColumn(unique=true,onDele

我需要在TYPO3流中支持文件上传(
)的
多个属性。这就是我到目前为止所做的

我有一个具有资源集合的实体:

/**
 * @var \Doctrine\Common\Collections\Collection<\TYPO3\Flow\Resource\Resource>
 * @ORM\ManyToMany(cascade={"all"})
 * @ORM\JoinTable(inverseJoinColumns={@ORM\JoinColumn(unique=true,onDelete="cascade")})
 */
 protected $resources;
因此,视图帮助程序
将为多个文件创建一个数组字段:

<input multiple="multiple" name="entity[resources][]" type="file">
问题是,每次调用update操作时,只要已经存在上载,就会重新添加现有上载,并且表
typo3\u flow\u resource\u resource
会不断增长。有人知道怎么解决吗

注意 此解决方案应仅允许替换上载的文件

<input multiple="multiple" name="entity[resources][]" type="file">
<input name="entity[resources][0][submittedFile][filename]" value="Foo.jpg" type="hidden">
<input name="entity[resources][0][submittedFile][resourcePointer]" value="7c94c0200e9f25b1ccb48c2853147f52286328d0" type="hidden">
<input multiple="multiple" name="entity[resources][]" type="file">
protected function initializeAction() {
    parent::initializeAction();

    switch($this->actionMethodName) {
        case 'createAction':
        case 'updateAction':
            $this->arguments
                ->getArgument('resource')
                ->getPropertyMappingConfiguration()
                ->forProperty('resources.*')
                ->setTypeConverterOption(
                    'TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter',
                    \TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED,
                    TRUE
                );
            break;
    }
}