[BUGFIX] add _loadRealInstance in f:form ViewHelper 95/32895/2
authorStefan Froemken <froemken@gmail.com>
Fri, 1 Aug 2014 13:01:15 +0000 (15:01 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 20 Sep 2014 15:13:48 +0000 (17:13 +0200)
If you edit a form containing subproperties of your domain model,
f:form VH will add some hidden fields to identify your related
domain models (__identity).
But in case of @lazy annotations, these fields will not be
rendered because of a missing _loadRealInstance call
in AbstractFormViewHelper object.

Releases 6.3, 6.2
Resolves: #60726
Change-Id: I67864e5b80752ff4350efabc72bd2b0a89d33bad
Reviewed-on: http://review.typo3.org/32895
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php

index 042d67d..a83f7b2 100644 (file)
@@ -59,6 +59,9 @@ abstract class AbstractFormViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\A
         * @see \TYPO3\CMS\Extbase\Mvc\Controller\Argument::setValue()
         */
        protected function renderHiddenIdentityField($object, $name) {
+               if ($object instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
+                       $object = $object->_loadRealInstance();
+               }
                if (!is_object($object)
                        || !($object instanceof \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject)
                        || ($object->_isNew() && !$object->_isClone())) {