使用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
最满意答案
如果没有问题,如果有更多的文件:
$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
相关问答
更多-
一个方法的管理员权限(Admin rights for a single method)[2021-09-09]
您可以向方法添加一个PrincipalPermission属性以要求其执行的管理权限: [PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")] public void MyMethod() { } 这在下面的文章中有更详细的描述: C#.Net中的安全原则和本地管理员权限 如果您正在寻找一种提升现有流程的方法,我怀疑这是可能的,因为管理员权限在进程级别提供给启动时的进程(请参阅此相关问题 )。 您必须以管 ... -
你怎么能让java中的特定方法需要管理员权限?(How can you make specific methods in java require admin rights?)[2023-04-15]
以下是针对不同用户使用级别的示例。 我模仿Java和其他供应商处理日志级别的方式。 通过使用反射,我可以检查请求用户是否具有正确的用户级别来查看方法。 这是一种简单的方法,可以筛选出在运行时可以或不可以访问某个方法的人员。 用户类型 package auth; public enum UserType { ADMIN(Integer.MIN_VALUE), SYSTEM(10000), GENERAL(20000), NONE(Integer.MAX_VALUE); ... -
本地机器管理员权限?(Local Machine Admin rights?)[2021-02-09]
我发现大多数开发工具都要求用户成为管理员才能在所有情况下正常工作。 这有点烦人,因为作为开发者,我们应该切换到非管理员帐户进行测试,但这是可行的。 但是,如果您的问题是“我们是否应该成为管理员用户才能使用我们的工具”,那么我的答案就是否定的。 除非你写驱动程序,否则真的没有什么理由(我能想到)应该需要管理员帐户。 I've found that most development tools require the user to be an admin to work correctly in all ca ... -
BATCH回避管理员权限(BATCH evading admin rights)[2023-07-21]
为什么不简单地更改目标文件夹的安全选项? 只要给任何用户一个写权限。 没有意义 - 如果用户因安全策略而无法写入某个位置。 如果有一种方法允许用户写入某个位置,即使他不被允许,你也只会逃避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 ...
-
C#管理员权限问题(C# admin rights issues)[2022-01-08]
如果您检查任务管理器,您将看到游戏仍以另一个用户身份运行,即管理员。 这很可能意味着游戏会在用户配置文件中保存一些信息,例如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 ...
-
如果声明不工作AutoIT(If statement not working AutoIT)[2021-08-23]
您的代码有两个主要问题。 第一个是MouseClick()不检查是否按下了鼠标按钮,而是发送鼠标按钮单击。 由于发送鼠标按钮单击将成功,MouseClick($ MOUSE_CLICK_RIGHT)== 1将评估为true。 对于您创建的每个列表视图项,您将电子邮件地址放在剪贴板上。 第二个问题是if语句位于错误的位置。 它是在您创建每个列表视图项之后执行的。 而是,如下更改您的While语句 While 1 Global $Msg = GUIGetMsg() Switch $Msg Case -3 ...