【发布时间】:2015-08-14 08:24:01
【问题描述】:
我想在一个流体视图表单中创建一个父对象,并在一个 StorageObject(1:n 关系)中包含多个子对象。 FormData 将被传输到数据库,如果出现错误,NEW Property Mapper 的验证器将返回它。但只有在父对象的表单域中才会出现“f3-form-error”类。但是在不一致的子对象上没有任何反应。
(在 Typo3 6.2.5 中工作)
正如您在下面的简短示例中所见,ChildObjects Authors 的 Propertymapping 没有获得给定的 UID。相反,映射器提供了一个自定义 ID。我想这就是 ValidationResult 没有返回到输入框的原因。
请帮忙!
简短示例:
//控制器
public function initializeCreateAction() {
$this->arguments->getArgument('newSubmission')->getPropertyMappingConfiguration()->allowProperties('authors');
$this->arguments->getArgument('newSubmission')->getPropertyMappingConfiguration()->allowCreationForSubProperty('authors.*');
$this->arguments->getArgument('newSubmission')->getPropertyMappingConfiguration()->forProperty('authors.*')->allowProperties('firstname');
}
// 流体
<f:form.textfield property="type" /><br />
<f:for each="{authors}" as="author" key="uid" iteration="iterator">
<f:form.textfield property="authors.{uid}.firstname" placeholder="Enter your first given name" />
</f:for>
// 调试
$result = $this->getControllerContext()->getRequest()->getOriginalRequestMappingResults();
//输出
array(19 items)
newSubmission.type => array(1 item)
0 => TYPO3\CMS\Extbase\Validation\Errorprototypeobject
message => 'The given subject was NULL.' (27 chars)
code => 1221560910 (integer)
arguments => array(empty)
title => '' (0 chars)
newSubmission.authors.000000006200d7b200007f3972b36107.email => array(1 item)
0 => TYPO3\CMS\Extbase\Validation\Errorprototypeobject
message => 'The given subject was not a valid email address.' (48 chars)
code => 1221559976 (integer)
arguments => array(empty)
title => '' (0 chars)
newSubmission.authors.000000006200d7b400007f3972b36107.email => array(1 item)
0 => TYPO3\CMS\Extbase\Validation\Errorprototypeobject
message => 'The given subject was not a valid email address.' (48 chars)
code => 1221559976 (integer)
arguments => array(empty)
title => '' (0 chars)
newSubmission.authors.000000006200d7b700007f3972b36107.email => array(1 item)
0 => TYPO3\CMS\Extbase\Validation\Errorprototypeobject
message => 'The given subject was not a valid email address.' (48 chars)
code => 1221559976 (integer)
arguments => array(empty)
title => '' (0 chars)
【问题讨论】:
标签: validation typo3 extbase