[BUGFIX] groupFor-VH does not work with @lazy 50/24050/2
authorStefan Froemken <froemken@gmail.com>
Wed, 25 Sep 2013 13:50:41 +0000 (15:50 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 26 Sep 2013 21:26:09 +0000 (23:26 +0200)
If you group an property with annotated @lazy option
f:groupedFor-ViewHelper can't group by this property.

Resolves: #52266
Releases: 6.2, 6.1, 6.0
Change-Id: Ie208b67eec8500fee87ee1c62b1bd348c0ed5598
Reviewed-on: https://review.typo3.org/24050
Reviewed-by: Xavier Perseguers
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/fluid/Classes/ViewHelpers/GroupedForViewHelper.php

index fd78d5f..33e5310 100644 (file)
@@ -126,6 +126,9 @@ class GroupedForViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractView
                        }
                        $currentGroupKeyValue = $currentGroupIndex;
                        if (is_object($currentGroupIndex)) {
+                               if ($currentGroupIndex instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
+                                       $currentGroupIndex = $currentGroupIndex->_loadRealInstance();
+                               }
                                $currentGroupIndex = spl_object_hash($currentGroupIndex);
                        }
                        $groups['keys'][$currentGroupIndex] = $currentGroupKeyValue;