[BUGFIX] DateTime properties are not mapped correctly
authorBastian Waidelich <bastian@typo3.org>
Wed, 2 Nov 2011 11:43:00 +0000 (12:43 +0100)
committerBastian Waidelich <bastian@typo3.org>
Mon, 21 Nov 2011 15:32:10 +0000 (16:32 +0100)
With the new property mapper *disabled* properties of type
DateTime are not correctly mapped to DateTime objects.
The reason is that the Object Container dies with an
exception when trying to reflect the (internal) constructor
arguments of DateTime objects.
This change fixes this by circumventing the Object Container
for DateTime objects.

Change-Id: I3db596a949a14941e89d67ecaa7a0606f5a80231
Resolves: #31345

typo3/sysext/extbase/Classes/Object/ObjectManager.php

index 8a4957a..12bcaaf 100644 (file)
@@ -90,7 +90,12 @@ class Tx_Extbase_Object_ObjectManager implements Tx_Extbase_Object_ObjectManager
        public function create($objectName) {
                $arguments = func_get_args();
                array_shift($arguments);
-               $instance = $this->objectContainer->getInstance($objectName, $arguments);
+               if ($objectName === 'DateTime') {
+                       array_unshift($arguments, $objectName);
+                       $instance = call_user_func_array(array('t3lib_div', 'makeInstance'), $arguments);
+               } else {
+                       $instance = $this->objectContainer->getInstance($objectName, $arguments);
+               }
 
                if ($instance instanceof t3lib_Singleton) {
                        throw new Tx_Extbase_Object_Exception_WrongScope('Object "' . $objectName . '" is of not of scope prototype, but only prototype is supported by create()', 1265203124);