#1216909923:参数“ multimedia”不存在。 (更多信息)Typo3

时间:2019-02-07 09:12:56

标签: php typo3 extbase

我有一个更新实体的表格。当我尝试调用updateAction()时,它返回一个错误。是什么原因?我该如何解决该问题?

form.html:

<f:form action="update" enctype="multipart/form-data" name="multimedia"  object="{multimedia}" id="multimediaEditForm">
          <f:render partial="Multimedia/FormFields" arguments="{_all}" />
</f:form>

updateAction:

/**
 * Setting TypeConverter option for file upload
 */
public function initializeUpdateAction()
{

    $this->setTypeConverterConfiguration('multimedia');
}

/**
 * action update
 *
 * @TYPO3\CMS\Extbase\Annotation\Validate("PITS\RccMultimedia\Domain\Validator\MultimediaValidator", param="$multimedia")
 * @return void
 */
public function updateAction()
{
    $updatedBy = $GLOBALS['TSFE']->fe_user->user ;
    $userObject = $this->userRepository->findByUid($updatedBy['uid']);

    $multimedia = $this->request->getArgument('multimedia');
}

/**
* For mapping properties to object
*/
protected function setTypeConverterConfiguration($argument)
{
    $uploadConfiguration = array(
            UploadedFileReferenceConverter::CONFIGURATION_ALLOWED_FILE_EXTENSIONS => 'jpg,jpeg,html,css,html,png,bmp,txt,doc,docx,xlf,ico,gif,ogg,tiff,mp4,wmv,webm,movie,pdf',
            UploadedFileReferenceConverter::CONFIGURATION_UPLOAD_FOLDER => 'fileadmin/user_upload',
    );
    /** @var PropertyMappingConfiguration $newFileConfiguration */
    $newFileConfiguration = $this->arguments[$argument]->getPropertyMappingConfiguration();
    $newFileConfiguration->forProperty('multimediaFile')->setTypeConverterOptions('Vendor\\Multimedia\\Property\\TypeConverter\\UploadedFileReferenceConverter', $uploadConfiguration);
}

$this->arguments返回空,但$this->request->getArgument('multimedia');具有该值。

1 个答案:

答案 0 :(得分:0)

您必须在updateAction()上添加一个参数,否则,如您所知,数据仅在Web请求中可用:

/**
 * action update
 */
public function updateAction(Multimedia $multimedia)
{
    // ...
}

在这里,您的Multimedia模型是直接使用的,因此可以方便地在您的操作中使用。还要注意,由于domain model validators是自动添加的,因此可以删除明确的验证者提及。