首页 \ 问答 \ 使用Typo3 Extbase Fluid创建并验证父/子对象(Create an and validate Parent/Child Objects with Typo3 Extbase Fluid)

使用Typo3 Extbase Fluid创建并验证父/子对象(Create an and validate Parent/Child Objects with Typo3 Extbase Fluid)

我想在Fluid View窗体中创建一个父对象,在StorageObject中有几个子对象(1:n关系)。 FormData将被传输到数据库,如果出现错误,NEW Property Mapper的验证器将返回它。 但只有在父对象的表单字段中才会出现“f3-form-error”类。 但是在不一致的子对象上没有任何反应。

(在Typo3 6.2.5中工作)

正如您在下面的简短示例中所看到的,ChildObjects作者的Propertymapping没有获得给定的UID。 而是Mapper提供自定义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)

I want to create a Parent Object in a Fluid View Form with several Child Objects in a StorageObject (1:n Relation). The FormData will be transferred to the database and in case of an error the validator of the NEW Property Mapper returns it. But only in the form field of the parent object the "f3-form-error" class appears. But nothing happens on inconsistent child objects.

(Working in Typo3 6.2.5)

As you can see in a short example below, the Propertymapping for the ChildObjects Authors doesn't get the given UID. Instead the Mapper gives an custom ID. I think this is the reason why the ValidationResult isn't returned to input box.

Please help!

Short Example:

//Controller

    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');

        }

// Fluid

<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>

// Debug

$result = $this->getControllerContext()->getRequest()->getOriginalRequestMappingResults();

//Output

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)

原文:https://stackoverflow.com/questions/32005501
更新时间:2023-08-18 19:08

最满意答案

如果没有问题,如果有更多的文件:

$a = 1

If($a = 1) Then

Run(Run Script with #RequireAdmin)

Else

Run(Run Script without #RequireAdmin)

EndIf

If it's no problem if there are more files:

$a = 1

If($a = 1) Then

Run(Run Script with #RequireAdmin)

Else

Run(Run Script without #RequireAdmin)

EndIf

相关问答

更多
  • 您可以向方法添加一个PrincipalPermission属性以要求其执行的管理权限: [PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")] public void MyMethod() { } 这在下面的文章中有更详细的描述: C#.Net中的安全原则和本地管理员权限 如果您正在寻找一种提升现有流程的方法,我怀疑这是可能的,因为管理员权限在进程级别提供给启动时的进程(请参阅此相关问题 )。 您必须以管 ...
  • 以下是针对不同用户使用级别的示例。 我模仿Java和其他供应商处理日志级别的方式。 通过使用反射,我可以检查请求用户是否具有正确的用户级别来查看方法。 这是一种简单的方法,可以筛选出在运行时可以或不可以访问某个方法的人员。 用户类型 package auth; public enum UserType { ADMIN(Integer.MIN_VALUE), SYSTEM(10000), GENERAL(20000), NONE(Integer.MAX_VALUE); ...
  • 我发现大多数开发工具都要求用户成为管理员才能在所有情况下正常工作。 这有点烦人,因为作为开发者,我们应该切换到非管理员帐户进行测试,但这是可行的。 但是,如果您的问题是“我们是否应该成为管理员用户才能使用我们的工具”,那么我的答案就是否定的。 除非你写驱动程序,否则真的没有什么理由(我能想到)应该需要管理员帐户。 I've found that most development tools require the user to be an admin to work correctly in all ca ...
  • 为什么不简单地更改目标文件夹的安全选项? 只要给任何用户一个写权限。 没有意义 - 如果用户因安全策略而无法写入某个位置。 如果有一种方法允许用户写入某个位置,即使他不被允许,你也只会逃避Windows安全策略 - 这是不可能的,或者至少不是有意的。 TL; DR:Ither通过更改目标目录的安全设置或提升用户权限,授予用户写入所需位置的权限。 Why don't you simply change the security options for the target folder? Just give ...
  • 以管理员身份运行Eclipse,您将能够在文件系统上的任何位置进行编写 Run Eclipse as Administrator, and you will be able to write anywhere on the file system
  • 您可以从authorize属性继承并覆盖authorizecore,然后只需使用该属性修饰您的控制器和/或方法来处理此场景。 例如: public class PageAuthorizeAttribute : AuthorizeAttribute { protected override bool AuthorizeCore(HttpContextBase httpContext) { if (/*Rolemanager check*/) { retu ...
  • 如果您检查任务管理器,您将看到游戏仍以另一个用户身份运行,即管理员。 这很可能意味着游戏会在用户配置文件中保存一些信息,例如AppSettings(如配置文件中的热键)或存储在AppData中的游戏修改,这可能会导致您提到的问题。 “重新运行”您的程序的用户仍然是提升用户,虽然权限较少,并且该用户启动游戏。 您无法正确“无人值守”一个过程,直到操作系统认为它以登录用户身份运行,因此您必须执行其他操作。 您可以查看是否可以将特定于用户的资源移动到相对于游戏而非用户的路径,或者通过任何其他方式(但直接从您的方式 ...
  • 如果没有问题,如果有更多的文件: $a = 1 If($a = 1) Then Run(Run Script with #RequireAdmin) Else Run(Run Script without #RequireAdmin) EndIf If it's no problem if there are more files: $a = 1 If($a = 1) Then Run(Run Script with #RequireAdmin) Else Run(Run Script ...
  • 如果您正在使用.Net中的内置邮件类,那么根本不需要将附件写入文件,除非生成报告的内容需要它。 这可行,假设您的报告生成器不需要文件输出,只能返回字节。 SmtpClient smtpClient = new SmtpClient(); //do whatever else you need to do here to configure this byte[] report = GetReport();//whatever your report gener ...
  • 您的代码有两个主要问题。 第一个是MouseClick()不检查是否按下了鼠标按钮,而是发送鼠标按钮单击。 由于发送鼠标按钮单击将成功,MouseClick($ MOUSE_CLICK_RIGHT)== 1将评估为true。 对于您创建的每个列表视图项,您将电子邮件地址放在剪贴板上。 第二个问题是if语句位于错误的位置。 它是在您创建每个列表视图项之后执行的。 而是,如下更改您的While语句 While 1 Global $Msg = GUIGetMsg() Switch $Msg Case -3 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)