[+BUGFIX] Extbase (MVC): Fixed UriBuilder for handling LazyLoadingProxy objects as...
authorMarc Bastian Heinrichs <heinrichs@mbh-web.de>
Tue, 30 Nov 2010 12:09:44 +0000 (12:09 +0000)
committerMarc Bastian Heinrichs <heinrichs@mbh-web.de>
Tue, 30 Nov 2010 12:09:44 +0000 (12:09 +0000)
typo3/sysext/extbase/Classes/MVC/Web/Routing/UriBuilder.php

index 72387a8..b5e35f3 100644 (file)
@@ -586,6 +586,13 @@ class Tx_Extbase_MVC_Web_Routing_UriBuilder {
         */
        protected function convertDomainObjectsToIdentityArrays(array $arguments) {
                foreach ($arguments as $argumentKey => $argumentValue) {
+                       // if we have a LazyLoadingProxy here, make sure to get the real instance for further processing
+                       if ($argumentValue instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
+                               $argumentValue = $argumentValue->_loadRealInstance();
+                               // also update the value in the arguments array, because the lazyLoaded object could be 
+                               // hidden and thus the $argumentValue would be NULL.
+                               $arguments[$argumentKey] = $argumentValue;
+                       }
                        if ($argumentValue instanceof Tx_Extbase_DomainObject_AbstractDomainObject) {
                                if ($argumentValue->getUid() !== NULL) {
                                        $arguments[$argumentKey] = $argumentValue->getUid();