[BUGFIX] PropertyMapper does not work with class aliasses 78/26578/3
authorFrans Saris <franssaris@gmail.com>
Sun, 29 Dec 2013 21:18:17 +0000 (22:18 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sun, 2 Feb 2014 12:12:35 +0000 (13:12 +0100)
Currently the property mapper uses the classnames found
in the the class property annotations to find the right
TypeConverter. But for class aliases this breaks as the
alias is used and not the original classname.

There was already a getClassNameForAlias call but this was
to early.

This change moves the getClassNameForAlias() call from
doMapping() to findTypeConverter().

Releases: 6.2, 6.1
Resolves: #54289
Change-Id: Ie4ab3deb3c192290db62ea06826870d2fadba8a7
Reviewed-on: https://review.typo3.org/26578
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/extbase/Classes/Property/PropertyMapper.php

index 94e41db..735b3bb 100644 (file)
@@ -129,9 +129,6 @@ class PropertyMapper implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected function doMapping($source, $targetType, \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration, &$currentPropertyPath) {
                if (is_object($source)) {
-                       // This is needed to correctly convert old class names to new ones
-                       // This compatibility layer will be removed with 7.0
-                       $targetType = \TYPO3\CMS\Core\Core\ClassLoader::getClassNameForAlias($targetType);
                        $targetType = $this->parseCompositeType($targetType);
                        if ($source instanceof $targetType) {
                                return $source;
@@ -205,6 +202,10 @@ class PropertyMapper implements \TYPO3\CMS\Core\SingletonInterface {
                }
 
                $targetType = $this->parseCompositeType($targetType);
+               // This is needed to correctly convert old class names to new ones
+               // This compatibility layer will be removed with 7.0
+               $targetType = \TYPO3\CMS\Core\Core\ClassLoader::getClassNameForAlias($targetType);
+
                $converter = NULL;
 
                if (\TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::isSimpleType($targetType)) {