Bug #78607
openValidationResults viewhelper for-attribute object handling
0%
Description
When you have a partial fluid template in your extbase / fluid extension for outputting the validation results of an object creation or updating, there seems to be a strange / unexpected behaviour to me, which can lead to a pitfall especially for developers new to extbase and fluid. The following example of passing the object {user} in e.g. EXT:somextension/Resources/Private/Templates/User/Edit.html and EXT:somextension/Resources/Private/Templates/User/New.html works fine. This seems strange to me as the object was assigned to both templates as a lowercase "user" and not as upper camelcase "User" via $this->view->assign('user', $user):
... <f:render partial="FormErrors.html" arguments="{object : User}" /> ...
Whereas the partial EXT:somextension/Resources/Private/Partials/FormErrors.html looks like this:
... <f:form.validationResults for="{object}"> ... </f:form.validationResults> ...
When I change the line in the template EXT:somextension/Resources/Private/Templates/User/Edit.html to the obviously correct way of spelling object "user", it throws an uncaught TYPO3 Exception #1: PHP Warning: Illegal offset type in isset or empty in ../typo3/sysext/extbase/Classes/Error/Result.php line 214:
... <f:render partial="FormErrors.html" arguments="{object : user}" /> ...
When I change the line in the template EXT:somextension/Resources/Private/Templates/User/Edit.html to the obviously correct way of spelling object "user", it still works fine though:
... <f:render partial="FormErrors.html" arguments="{object : user}" /> ...
I think this is a kind of unexpected / irrational behaviour and should be corrected, as it can lead to unnecessary confusion and frustration for beginner developers in extbase and fluid.