Bug #78607

ValidationResults viewhelper for-attribute object handling

Added by Matthias Krappitz almost 3 years ago. Updated 5 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Start date:
2016-11-08
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
5.6
Tags:
extbase, fluid
Complexity:
Is Regression:
No
Sprint Focus:

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.

History

#1 Updated by Matthias Krappitz almost 3 years ago

TYPO3 version 6.2.28

#2 Updated by Benni Mack 5 months ago

  • Target version changed from next-patchlevel to Candidate for patchlevel

Also available in: Atom PDF